Visual Studio 2022 not loading dependencies

Viewed 3825

I seem to be having an issue with running projects after upgrading to Visual Studio 2022 and installing Net 6.0 SDK. Whenever I open an existing project or even create a new one I get the below errors with the Dependencies.

enter image description here

If I try building the project I get the error:

enter image description here

There aren't any errors in the Error list.

Tried a few things but still nothing helps :

I've tried reinstalling Visual Studio 2022 and Net 6.0

  • Tried unloading and reloading project
  • Tried clearing Nuget cache
  • Tried removing bin,obj, csproj.user,.vs folder

If I try building/debugging a project in Visual Studio Code everything works normally so it doesn't seem to be an issue with the SDK.

Also noticed that I am unable to open the Nuget Package Manager UI but the .csproj file is correct and void of any errors.

Anyone have any ideas on how to resolve this?

3 Answers

I usually install the SDK's manually which seems to have caused the issue.

The solution to fixing this is to uninstall all manually installed SDK packages.

Following the SDK uninstall's, reinstall the net 6.0 and/or prior releases from the Visual Studio installer. I did a fresh install just incase.

All dependencies should load correctly now for net 6.0 projects. If not, please delete the .vs, bin and obj folder for the specific project and open it again in VS2022 and the dependencies should load. Delete the same folders for projects on previous versions.

You may also get this problem if the path to your project contains a "%20" in the path.

This can happen if you clone a repo from Azure DevOps where the repo name has a space in it.

E.g.:

git@ssh.dev.azure.com:v3/company/MY%20Project/MY%20Project

Becomes:

c:\repos\MY%20Project

Remove the "%20" in the path resolves the problem:

c:\repos\MY-Project

have you tried dotnet build? that usually forces auto resolving of dependencies!

I've also faced similar issues in recent days after the final release of 2022.

Related