Visual Studio 2022 Projects fails to build because it cannot copy a dependency from the local .nuget directory.

Tom Brown 30 Reputation points
2023-05-24T22:49:47.1533333+00:00

One of my Visual Studio 2022 Projects fails to build because it cannot copy a dependency from the local .nuget directory.

However, I have checked the directory location and verified that the file is located on my local file directory at the exact location where Visual Studio is saying that it should be.

The error returns the code: MSB3030 and points to this resource.

The full error message is:

"C:\Users\xxx.xxx.nuget\packages\system.collections.specialized\4.3.0\lib\netstandard1.3\System.Collectɩons.Specialized.dll" because it was not found.        

C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64        

C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets

Note that I can build other projects in the same environment.

I’ve taken the following steps:

  • Ran dotnet restore and updated packages.
  • Increased the verbosity of the output console to see if it could provide any insight. But no additional information was provided.
  • Confirmed that the system and my user account has permission to access the file in question.
  • Removed the package from the project and local file system, all references to the package (that I could find), and deleted the local cache. Then I reinstalled the package to see if that would clear the problem. It did not.

I can’t seem to find a solution to this problem. And my Google-Fu just has taken me full circle.

Does anyone have any advice?

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,157 questions
{count} votes