Updating a .NET website from 4.6 to 4.8 and after updating all the packages in Visual Studio’s package NuGet Package manager, I got the following warning that wouldn’t go away:

Warning Some NuGet packages were installed using a target framework different from the current target framework and may need to be reinstalled. Visit https://docs.nuget.org/docs/workflows/reinstalling-packages for more information. Packages affected: Serilog project_name.solution_name 0

Following that link https://docs.nuget.org/docs/workflows/reinstalling-packages it suggested updating your packages would fix it, which it didn’t for me.

So then I tried re-installing each package in turn in the Package Manager Console, with:

Update-Package -Id <package_name> –reinstall

Which also didn’t remove the warning even though I did this for every package.

What did work, though it didn’t seem to be documented on the page specifically, was:

Update-Package -reinstall

Which re-installs all packages in all solutions in the project, so be careful, this takes some time!

After this, the warning finally vanished.

Note, they say:

To update all packages in a solution, just use Update-Package by itself with no other arguments or switches. Use this form carefully, because it can take considerable time to perform all the updates:

#Updates all packages in all projects in the solution
Update-Package

But this tries to update all your packages, not re-install them, for that use the above command Update-Package -reinstall.

Last modified: April 27, 2023

Author

Comments

Write a Reply or Comment

Your email address will not be published.