A strange Visual Studio 2022 error just started happening today. I was trying to install/update/consolidate the NuGet packages for my .NET C# solution (which was working perfectly before), and then each time I tried to do so through the NuGet UI, I was presented with this popup:
Clicking Save gives me this dialog:
Clicking Yes makes the dialog go away.
But then when I cancel the main Explorer window, it pops up again.
Why is this happening? I have verified that I do not have the project file open in any other editors.
Eventually, it stops popping up, but then I end up with my needed packages not getting installed:
Running Restore NuGet Packages for Solution doesn’t work either. I get this for each project in my solution:
Failed to resolve all items referenced by ‘xxx.xxx.xxxxxx.xxx.xxx.csproj’. This message can typically be ignored. The issue may be resolved by fully restoring and building the solution. If the unresolved item is a project reference this can lead to an incomplete NuGet restore result and missing package references. To ensure that restore is able to find all projects verify that all projects are referenced correctly and exist on disk.
========== Finished ==========
2
From looking at your error message,
The missing file is .. packagesMSTest.TestAdapter.1.3.2buildnet45
MSTest.TestAdapter.props.
The missing file is .. packagesMicrosoft.Testing.Platform.1.2.1buildnetstandard2.0
Microsoft.Testing.Platform.prons.
This error might occur in several scenarios. Please check the following to narrow down your issue.
-
If you use
PackageReference
management format, this error might be a leftover from apackages.config
toPackageReference
migration and needs to be manually removed from the project file. -
If you use
packages.config
, the error means that the package is not installed in the packages folder at the solution root.nuget install xxx -OutputDirectory c:projpacakges
CLI Reference
-
This situation commonly occurs when you obtain the project’s source code from source control or another download. Packages are typically omitted from source control or downloads because they can be restored from package feeds like nuget.org.
-
The error can also happen if your project file contains absolute paths to package locations, and you move the project.
If you’ve moved the project file, edit the file directly to update the package references. -
Restore packages in Visual Studio and Allow NuGet to download missing packages.
Doc Referred:
This project references NuGet package(s) that are missing on this computer