NuGet 预发行限制

NuGet Prerelease Restrictions

nuget 允许预发布版本修饰符

例如,我正在开发 1.0.0 版本,可以添加预发布修改器,例如

但是如果我尝试设置类似

-nightly20170320191800

失败

所以我的问题是这个预发布字符串的具体限制是什么

请在此处从 MSDN 文档中查看:https://docs.microsoft.com/en-us/nuget/create-packages/prerelease-packages and also this post in SO: How to publish nuget prerelease version package

好吧,我想通了:

我使用的是 nuget 3.3.0,它在没有任何有意义的消息的情况下就死了 (Version string invalid)

nuget 3.5.0 死于 The special version part cannot exceed 20 characters.

并且删除了此限制(https://github.com/NuGet/Home/issues/2735)

现在我使用 nuget 4.0.0,它按预期工作。

所以正确答案是:

来自 SemVer 规范 2.0 (http://semver.org/)

A pre-release version MAY be denoted by appending a hyphen and a series of dot separated identifiers immediately following the patch version. Identifiers MUST comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. Numeric identifiers MUST NOT include leading zeroes. Pre-release versions have a lower precedence than the associated normal version. A pre-release version indicates that the version is unstable and might not satisfy the intended compatibility requirements as denoted by its associated normal version. Examples: 1.0.0-alpha, 1.0.0-alpha.1, 1.0.0-0.3.7, 1.0.0-x.7.z.92.

但是一些过去的 nuget 版本(最高 3.5.0)添加了额外的长度限制。版本 4.0.0 在这方面按照规范定义工作。