Nuget 版本限制

Nuget version restrictions

我正在使用 Nuget 4.3.0.4406 打包版本为 5.2.29.181212.8244-RC 的程序集,但我得到

2018-12-12T08:44:02.8053309Z ##[error]The nuget command failed with exit code(1) and error('5.2.29.181212.8244-RC' is not a valid version string. Parameter name: value)

版本控制不符合 semver,但 Nuget 施加了限制,目前尚不清楚是哪个..?这是否意味着 Nuget 不仅支持 SemVer,而且强制执行它?我找到了 this 但我不确定 SpecialVersion?

是什么意思

基本上我只想要 x.y.z.[date+buildid](-rc) 其中 x.y.z 与规范版本相关联,因此不能省略(我们不拥有该版本控制)。

更新

摘自 Microsoft 文档 NuGet Package Versioning Reference

With NuGet 4.3.0+ and Visual Studio 2017 version 15.3+, NuGet supports Semantic Versioning 2.0.0.

Certain semantics of SemVer v2.0.0 are not supported in older clients. NuGet considers a package version to be SemVer v2.0.0 specific if either of the following statements is true:

  • The pre-release label is dot-separated, for example, 1.0.0-alpha.1
  • The version has build-metadata, for example, 1.0.0+githash

For nuget.org, a package is defined as a SemVer v2.0.0 package if either of the following statements is true:

  • The package's own version is SemVer v2.0.0 compliant but not SemVer v1.0.0 compliant, as defined above.
  • Any of the package's dependency version ranges has a minimum or maximum version that is SemVer v2.0.0 compliant but not SemVer v1.0.0 compliant, defined above; for example, [1.0.0-alpha.1, ).

当然,您可以在 semver.org. I think you're especially interested in spec-item10:

找到语义版本控制规范

Build metadata MAY be denoted by appending a plus sign and a series of dot separated identifiers immediately following the patch or pre-release version. Identifiers MUST comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. Build metadata SHOULD be ignored when determining version precedence. Thus two versions that differ only in the build metadata, have the same precedence. Examples: 1.0.0-alpha+001, 1.0.0+20130313144700, 1.0.0-beta+exp.sha.5114f85.

您的版本会变成 x.y.z(-rc)+[date+buildid]