Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

package.config update does not update the references

I have multiple projects referencing the same NuGet Package. When I got latest code, I realized that one of the projects had an updated package.config and also updated reference to the Dll that is provided by that package.

Now, I also updated package.config on other prjects hoping the as soon as I do an upgrade on that NuGet engine will see that and fetch me new DLLs. Well, it did not happen. After that I tried following things and none of them worked:

  1. Deleting the old version of DLL and then doing Restore package
  2. Deleting the packages folder, restarting my VS 2015 and restoring the package

Also, funny thing is that when I go to Manage Nuget Packages and look at the package for which I need new DLL, it shows that it is already at new version and I do not need to upgrade it.

Is there any ways I can get NuGet engine to upgrade these packages?

like image 750
Lost Avatar asked Apr 18 '17 18:04

Lost


People also ask

How do I force a NuGet package to Update?

Switch to the Browse tab, search for the package name, select it, then select Install). For all packages, delete the package folder, then run nuget install . For a single package, delete the package folder and use nuget install <id> to reinstall the same one.

What is package reference in Csproj?

Package references, using <PackageReference> MSBuild items, specify NuGet package dependencies directly within project files, as opposed to having a separate packages. config file. Use of PackageReference doesn't affect other aspects of NuGet; for example, settings in NuGet.


1 Answers

Just editing the packages.config file will not cause Visual Studio to make any changes to your project. Also NuGet restore does not modify your project. NuGet restore just downloads the NuGet packages and makes them available for your project.

Instead of editing the packages.config file I would just use the NuGet Package Manager in Visual Studio, or the Package Management Console, to update the NuGet package in the projects required.

Other alternatives include updating the project files (.csproj) to use the correct updated assembly references. Or you can run an Update-Package -reinstall to force the NuGet packages to be uninstalled and installed again in the projects. That will fix the assembly references.

like image 144
Matt Ward Avatar answered Oct 05 '22 03:10

Matt Ward