Updating package.config does not update links

I have several projects that reference the same NuGet package. When I received the last code, I realized that in one of the projects the package.config file was updated, as well as the link to the Dll provided by this package was updated.

Now I have also updated package.config in other projects, hoping that as soon as I upgrade on this NuGet engine, you will see this and bring me new DLLs. Well, that did not happen. After that, I tried to keep track of things, and none of them worked:

  • Removing an old version of the DLL and then performing a package restore
  • Deleting a package folder, rebooting my VS 2015 and restoring a package

It’s also funny that when I go to Manage Nuget Packages and look at a package for which I need a new DLL, it shows that it is already in the new version and I don’t need to update it.

Is there a way to get NuGet to update these packages?

+5
source share
2 answers

Simply editing the packages.config file will not cause Visual Studio to make any changes to your project. Also, NuGet recovery does not change your project. NuGet Recovery simply downloads NuGet packages and makes them available for your project.

Instead of editing the packages.config file, I would simply use the NuGet package manager in Visual Studio or in the package management console to update the NuGet package in the necessary projects.

Other alternatives include updating project files (.csproj) to use the correct updated assembly references. Or you can run Update-Package -reinstall to force-remove NuGet packages and install them again in projects. This will fix the assembly references.

+9
source

If your solution can be opened by Visual Studio 2017, I suggest using the latest PackageReference to control nuget. Packages.config has several drawbacks, and PackageReference solves these problems.

Here's the solution to go to PackageReference: https://github.com/NuGet/Home/wiki/Packages.config-to-PackageReference-Migrator

Alternatively, you can use this extension vs: https://marketplace.visualstudio.com/items?itemName=TaylorSouthwickMSFT.NuGetPackagetoProjectjsonConverter

0
source

Source: https://habr.com/ru/post/1266875/


All Articles