Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 683
Julius Avatar asked Sep 30 '15 11:09

Julius


People also ask

How do I Update NuGet package references?

To manage your package sources, select the Settings icon or select Tools > Options. In the Options window, expand the NuGet Package Manager node and select Package Sources. To add a source, select +, edit the Name, enter the URL or path in Source, and then select Update.

What is NuGet package reference?

PackageReference (or "package references in project files") | (NuGet 4.0+) Maintains a list of a project's top-level dependencies directly within the project file, so no separate file is needed.

Where are NuGet packages references stored?

The location of the default global packages folder. The default is %userprofile%\. nuget\packages (Windows) or ~/.


1 Answers

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.

like image 197
Matt Ward Avatar answered Oct 23 '22 04:10

Matt Ward