3

nuget allows prerelease version modifiers

for example i am working on version 1.0.0 and can add a prerelease modifer like

  • -beta
  • -rc
  • -beta2

However if i try to set something like

-nightly20170320191800

it fails

So my question is what are the concrete restrictions on this prerelease string

Christoph
  • 794
  • 1
  • 7
  • 19

2 Answers2

3

Well I figured it out:

I was using nuget 3.3.0 which just dies without a meaningful message (Version string invalid)

nuget 3.5.0 dies with The special version part cannot exceed 20 characters.

And this limitation was removed (https://github.com/NuGet/Home/issues/2735)

now i use nuget 4.0.0 and it works as expected.

So the correct answer would be:

from the SemVer spec 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.

However some past nuget versions (up to 3.5.0) added an additional length restriction. Version 4.0.0 works in this regard as defined by the specification.

Christoph
  • 794
  • 1
  • 7
  • 19
1

Please see it here from MSDN doc: https://learn.microsoft.com/en-us/nuget/create-packages/prerelease-packages and also this post in SO: How to publish nuget prerelease version package

Ricardo Serra
  • 374
  • 2
  • 11
  • 1
    Thanks, I already found those links. However they do not point out the concrete restrictions for the prerelease string. The SemVer spec states "The string MUST be comprised of only alphanumerics plus dash [0-9A-Za-z-]." So my "-nightly20170320191800" should be valid, but it is not. – Christoph Mar 21 '17 at 17:11