$version$ with -Version option?

Nov 10, 2011 at 2:40 PM

So I've run into something that seems a bit off for what I wanted to check.

I'm using the replacement variables that come from my project file in my nuspec file. One thing I do is use the versions in dependency, so I have the following in my nuspec file:

<dependency id="My.Dependency.Library" version="[$version$]"/>

I'm also calling nuget pack with the version option. I was hoping that the replacement would do what I wanted, but it fails, because the version of the package is (say) 2.0.11314.1 but the dependency is to, which is pulled from the csproj file. (both packages are built out of the same solution, and using NuGetter from nugetter.codeplex.com to build in a TFS automated build.). I know I could always use $version$ rather than [$version$], but I'd really like to force users to use exactly the same version if that's a possibility.

I guess the question is, is my assumption here just out of line, or is this a reasonable feature request?



Nov 11, 2011 at 3:55 PM

I'm sorry, a bit confused by what you're trying to achieve here. Does your dependency have a different version than the package version and you're trying to perform a token replacement for it? If so, you should be able to pass in arbitrary tokens via -Properties switch in nuget pack

nuget.exe pack Project.csproj -Properties DependencyVersion=  


Nov 11, 2011 at 4:03 PM

No, it's the same version. I was hoping that nuget pack -version= would cause the $version$ token to be updated, which it doesn't seem to. It only seems to replace the version of the package, not any additional instances of the $version$ token.

Good to know I can use additional dependencies, as that might be a workaround, but I really feel that $version$ should be usable.

I guess my real question is, should it?

Nov 11, 2011 at 4:13 PM

Sure, it wouldn't hurt to drop it in the properties dictionary in addition to setting the value of Version. Could you report a bug for this, I'll let triage make a call. In the meanwhile, using -Properties should still work.

nuget.exe pack Blah.nuspec -Properties Version=2.0.0 and use $version$ in both places.