问题
I'm trying to use semantiv versioning for one of my .Nuget Packages (.Net Core 2) The Version looks like this 1.0.0-my_fancy_branch.123.
As you can guess, I try to set the branch name and the current BuildId as a prerelease tag.
Unfortunately, dotnet build spews this error:
... is not a valid version string.
But why? The absolutely great documentation of dotnet push / nuget does not list any forbidden characters.
And I thought PIP is obtuse...
回答1:
According to the reference on NuGet package versions, NuGet uses Semantic Versioning 2.0.0 starting with NuGet 4.3.0. In earlier versions only a subset of SemVer 2.0.0 is supported, but this may still give a hint where the problem with the specified version is.
In Section 9 (about pre-release versions) it is specified that "Identifiers MUST comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-].". Hence, I guess that the problems in your case are the underscores in the pre-release version.
来源:https://stackoverflow.com/questions/49103650/nuget-semver-what-are-allowed-prerelease-characters