Reputation: 1946
So, previously we called nuget pack with the nuspec file (nuget pack myproj.nuspec
). The nuspec looked something like this:
<package>
<metadata>
<version>$version$</version>
[more properties]
<dependencies>
<dependency id="MySubProj" version="$version$" />
[more explicit dependencies]
</dependencies>
</metadata>
</package>
I switched the call to (nuget pack myproj.csproj
) so our always-outdated explicit dependencies would be auto-generated.
Everything works great, except now the finished nuspec is something like
<package>
<metadata>
<version>1.2.3.4</version>
[more properties]
<dependencies>
<dependency id="MySubProj" version="0.0.0.0" />
[more explicit dependencies]
</dependencies>
</metadata>
</package>
While the correct version of MySubProj would also be 1.2.3.4.
More infos:
I don't get what I am doing wrong really and why it would work when using the nuspec directly vs the csproj :/
Upvotes: 3
Views: 818
Reputation: 1124
Seems like a very old bug while using a csproj combined with nuspec (which is still there with NuGet 3.5) ...
One way of making this working is by adding an extra property
<package>
<metadata>
<version>$version$</version>
[more properties]
<dependencies>
<dependency id="MySubProj" version="$PackageVersion$" />
[more explicit dependencies]
</dependencies>
</metadata>
</package>
And then update your command
NuGet.exe pack myproject.csproj -Version 1.2.3.4 -Properties "PackageVersion=1.2.3.4"
It is not that clean, but it works.
Upvotes: 2