The `nuget pack` command doesn't produce packages with expected version info
See original GitHub issueQuite likely that this is user error, so would appreciate any pointers.
I have a project using NB.GV 2.0.41, building with msbuild 15 from the master branch, packing using NuGet 4.3.0.
My version.json
includes:
"publicReleaseRefSpec": [
"^refs/heads/master",
"^refs/tags/v\\d+\\.\\d+"
]
My .nuspec file includes:
<version>$version$</version>
When I do nuget pack -Build
, the resulting file is just MyPackage.1.0.4.nupkg
. But NuGet gives me a warning:
WARNING: Issue: Package version not supported on legacy clients.
WARNING: Description: The package version '1.0.4+g2b37059da8' uses SemVer 2.0.0 or components of SemVer 1.0.0 that are not supported on legacy clients. This message can be ignored if the package is not intended for older clients.
WARNING: Solution: Change the package version to a SemVer 1.0.0 string. If the version contains a release label it must start with a letter.
And in fact, the embedded version string in the package does include the git commit hash.
I thought that the point of the publicReleaseRefSpec
was to prevent the git hash from appearing in the package (although it does still appear in the AssemblyInformationalVersion
is the assembly itself).
Am I misunderstanding, or doing something stupid?
Issue Analytics
- State:
- Created 6 years ago
- Comments:23 (9 by maintainers)
Top Results From Across the Web
The `nuget pack` command doesn't produce packages with ...
I have a project using NB.GV 2.0.41, building with msbuild 15 from the master branch, packing using NuGet 4.3.0. ... When I do...
Read more >dotnet pack command does not generate .nuget packages ...
We have a solution with mutiple projects that includes projects with unit and spec tests. When we run dotnet pack command on the...
Read more >pack command (NuGet CLI)
Creates a NuGet package based on the specified .nuspec or project file. The dotnet pack command (see dotnet Commands) and msbuild -t:pack ...
Read more >Unable to resolve dependencies of NuGet packages
Solution · Clear the NuGet cache files. You do this in the following way: In the toolbar of Visual Studio, navigate to Tools...
Read more >NuGet packages in the Package Registry
When asking for versions of a given NuGet package name, the GitLab Package Registry returns a maximum of 300 most recent versions. Do...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We found a workaround/solution for our build process.
nuget pack
reference there are options to pass a version intonuget pack
command which overrides the version information from the.nuspec
file. This avoids the problem that NuGet tries to resolve the package version via the AssemblyInfo.In Azure DevOps we now use
nbgv cloud --all-vars
to determine the version for the build label and the version variables. We then use aNuGetCommand@2
to perform apack
command withYou can probably also just use something like
nuget pack -Version %NBGV_NUGETPACKAGEVERSION%
or whatever is appropriate in your build system to achieve the same result. Also other version strings are available.I emailed the NuGet team to point out the issue in the docs.
I’ve never tested NB.GV with
nuget pack
. I’m not 100% confident I’ll be able to make it work well withnuget pack
– it will be conditional on how flexible it is to read various properties, and whether NB.GV can detect that that is the scenario we’re running in.I’ll leave this issue open to track nuget pack behavior.