eli
(Eli Hess)
September 27, 2019, 9:42pm
1
I recently upgraded from 3.11.0-01 to 3.15.2-01. I setup a proxy to PowerShell Gallery and the newer version appears to be removing the fourth number from a module’s version if it is a zero. So if the module ‘xPendingReboot’ were at version ‘0.4.0.0’ it would trim it to ‘0.4.0’ which breaks the module when it downloads because the module manifest and the folder hierarchy no longer match. Is this a setting which is configurable somewhere?
rseddon
(Rich Seddon)
September 29, 2019, 5:14pm
2
What is your NuGet version?
NuGet clients (3.4+) will only send normalized versions:
eli
(Eli Hess)
September 30, 2019, 4:52pm
3
Aahhh man. That’s definitely it. Sounds like it’s causing widespread issues as well:
opened 11:25AM - 27 Jun 16 UTC
Priority:2
Type:DCR
help wanted
Functionality:Pack
Category:Quality Week
Hello,
It seems latest NuGet pack **ignores** the version set in the nuspec (or… via the `-Version` override flag) and the dependencies' versions, by normalising them, even if nobody asked for it :(
It seems this was "fixed" for this https://github.com/NuGet/Home/issues/2039, but to me this seems a super counter-intuitive change, that breaks (at least for us) the daily workflows.
For the meantime, we had to do a workaround to "fix" the versions in the generated nupkg. I'm hoping that this can be fixed either by removing this weird logic, or allowing the nuget pack command to generate nuget package which contains the _same_ versions as in the nuspec.
I'm using `NuGet Version: 3.4.4.1321`.
With this nuspec:
```
<?xml version="1.0" encoding="UTF-8"?><package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<authors>author</authors>
<version>1.9.0.0-SNAPSHOT</version>
<id>mylib</id>
<dependencies>
<dependency id="dependency" version="3.16.0.0"/>
</dependencies>
<description>mylib</description>
</metadata>
</package>
```
executing `nuget pack mylib.nuspec -Version 1.9.0.0-SNAPSHOT` generates this .nuspec:
```
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>mylib</id>
<version>1.9.0-SNAPSHOT</version>
<authors>author</authors>
<owners>author</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>mylib</description>
<dependencies>
<dependency id="dependency" version="3.16.0" />
</dependencies>
</metadata>
</package>
```
As we can see:
- Version is `1.9.0-SNAPSHOT` instead of `1.9.0.0-SNAPSHOT` (even if we **specifically** overrode it via the command line) - same happens with a non-SNAPSHOT version
- Even worse, the dependency version is `3.16.0` instead of `3.16.0.0`
- Funnily enough, the filename has the full version: `mylib.1.9.0.0-SNAPSHOT.nupkg`
Thank you! Glad to know it’s not a Nexus problem.