Search code examples
visual-studio-2015nuget.net-4.5nuget-clinuget-console

How I can set nuget package allowedversion only at solution level?


I use VS 2015 and .net 4.5 web project with 15 project.

I use by example a package in a couple of projects of my solution and each time I need to change the version for a specific version I need to open the package.config for each projects add allowedVersions.

I'm wondering if there is a way to configure globally only one time the allowedVersions instead of openning each file?


Solution

  • How I can set nuget package allowedversion only at solution level?

    I am afraid you could not set allowedversion at solution level.

    That because the allowedVersions attribute is used typically during update operations to constrain the versions in the packages.config file, and packages.config file is used for project level.

    The NuGet team deprecated solution level packages in NuGet 3.0. So we could not pull this attribute allowedversion from the package.config file and apply it to the solution level.

    Besides, the attribute allowedversion can be a range value and does not need to be a specific value. Does your project have strict restrictions on the nuget package version? Can it only be a specific version? If not, you can give a version range to the attribute allowedversion not using a specify version, like:

    allowedVersions="[1.3.2,1.5)"
    

    If you can only use a specific version in your project, I am afraid you have to openning each file to change that attribute.