Julius
Julius

Reputation: 946

What controls the Specific Version property of a reference in a NuGet package?

We have many libraries which are build in a CI, which deploy prereleases every time they build. Other projects depend on these and automatically updates them during build.

But the references are set with the Specific Version = true, which means that increasing the version number on these dlls causes the build to fail.

How can I control the setting of the property?

Upvotes: 6

Views: 2833

Answers (1)

Matt Ward
Matt Ward

Reputation: 47937

You cannot change NuGet's behaviour without changing its source code. NuGet will always sets SpecificVersion to true when adding a non-GAC assembly from within Visual Studio.

You would need to run some sort of post build script to fix the references or manually change them.

Not sure exactly how you are updating the projects in your CI server. If you use NuGet.exe update project.csproj then that will update to the latest NuGet package and will not set SpecificVersion to true. However the command line application does not support PowerShell scripts or content files, only references will be updated. This also assumes that there is an update available otherwise the reference will not be modified.

Upvotes: 5

Related Questions