简体   繁体   English

Visual Studio 2022 未加载依赖项

[英]Visual Studio 2022 not loading dependencies

I seem to be having an issue with running projects after upgrading to Visual Studio 2022 and installing Net 6.0 SDK.在升级到 Visual Studio 2022 并安装 Net 6.0 SDK 后,我似乎遇到了运行项目的问题。 Whenever I open an existing project or even create a new one I get the below errors with the Dependencies.每当我打开一个现有项目甚至创建一个新项目时,我都会收到以下依赖项错误。

在此处输入图像描述

If I try building the project I get the error:如果我尝试构建项目,我会收到错误:

在此处输入图像描述

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我尝试重新安装 Visual Studio 2022 和 Net 6.0

  • Tried unloading and reloading project尝试卸载和重新加载项目
  • Tried clearing Nuget cache尝试清除 Nuget 缓存
  • Tried removing bin,obj, csproj.user,.vs folder尝试删除 bin、obj、csproj.user、.vs 文件夹

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.如果我尝试在 Visual Studio Code 中构建/调试项目,一切正常,所以 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.还注意到我无法打开 Nuget Package 管理器 UI,但 .csproj 文件是正确的并且没有任何错误。

Anyone have any ideas on how to resolve this?有人对如何解决这个问题有任何想法吗?

have you tried dotnet build ?你试过dotnet build吗? that usually forces auto resolving of dependencies!这通常会强制自动解决依赖关系!

I've also faced similar issues in recent days after the final release of 2022.在 2022 年最终版本发布后的最近几天,我也遇到了类似的问题。

I usually install the SDK's manually which seems to have caused the issue.我通常手动安装 SDK,这似乎导致了这个问题。

The solution to fixing this is to uninstall all manually installed SDK packages.解决此问题的解决方案是卸载所有手动安装的 SDK 软件包。

Following the SDK uninstall's, reinstall the net 6.0 and/or prior releases from the Visual Studio installer.在卸载 SDK 之后,从 Visual Studio 安装程序重新安装 net 6.0 和/或以前的版本。 I did a fresh install just incase.我做了一个全新的安装以防万一。

All dependencies should load correctly now for net 6.0 projects.现在应该为 net 6.0 项目正确加载所有依赖项。 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.如果没有,请删除特定项目的.vs、bin和obj文件夹,然后在VS2022中再次打开,应该会加载依赖项。 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.如果您的项目路径在路径中包含“%20”,您也可能会遇到此问题。

This can happen if you clone a repo from Azure DevOps where the repo name has a space in it.如果您从 Azure DevOps 克隆存储库,其中存储库名称中有空格,则可能会发生这种情况。

Eg:例如:

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

Becomes:变成:

c:\repos\MY%20Project c:\repos\MY%20Project

Remove the "%20" in the path resolves the problem:删除路径中的“%20”即可解决问题:

c:\repos\MY-Project c:\repos\MY-Project

Has anyone resovled this issue?有没有人解决这个问题? I tried the following and still cannot get vs2022 to resolve dependencies even when creating a new blank solution...我尝试了以下方法,即使在创建新的空白解决方案时仍然无法让 vs2022 解决依赖关系......

"he solution to fixing this is to uninstall all manually installed SDK packages. “解决此问题的解决方案是卸载所有手动安装的 SDK 软件包。

Following the SDK uninstall's, reinstall the net 6.0 and/or prior releases from the Visual Studio installer.在卸载 SDK 之后,从 Visual Studio 安装程序重新安装 net 6.0 和/或以前的版本。 I did a fresh install just incase.我做了一个全新的安装以防万一。

All dependencies should load correctly now for net 6.0 projects.现在应该为 net 6.0 项目正确加载所有依赖项。 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.如果没有,请删除特定项目的.vs、bin和obj文件夹,然后在VS2022中再次打开,应该会加载依赖项。 Delete the same folders for projects on previous versions."删除以前版本中项目的相同文件夹。”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM