How do I resolve 'No projects supported by NuGet in the solution' error in Visual Studio 2022?

huangapple go评论76阅读模式
英文:

How do I resolve 'No projects supported by NuGet in the solution' error in Visual Studio 2022?

问题

"Visual Studios 2022"无法支持解决方案中的任何项目。

我的解决方案中有两个项目,两者都之前使用了从NuGet安装的两个包,并且继续由NuGet更新。最近,我尝试安装另一个包,似乎从未安装成功,或者可能不兼容,因为在尝试使用时无法解析引用。然后,我删除了该包并搜索了一个兼容的版本或替代方案。然而,当我从解决方案中的项目选择它时,包管理器无法加载/显示。选择“管理解决方案的NuGet包...”会导致以下错误:错误消息

然后,我注意到包管理器控制台中没有默认项目,也没有显示我的任何项目:默认项目下拉菜单

我还尝试修复了Visual Studio 2022,但似乎也没有什么作用。

更新: 解决方案是创建一个新项目,选择“管理NuGet包”,然后返回到以前的解决方案。

英文:

Visual Studios 2022 "No projects supported by NuGet in the solution"

I have two projects in my solution, both have previously been using 2 packages installed from NuGet and continue to be updated by NuGet. Recently I tried to install another package that seemed to have never installed properly or may have been incompatabile because it the reference wasn't resolving when trying to use it. I then removed that package and searched for a compatible verison or altnertive. However, when the package manager wouldn't load/display when selecting it from a project within the solution. Selecting "Manage NuGet Packages for solution..." results in the following error: Error Message

I then noticed that there was no default project in the Package Manager Console and none of my projects showed up: Default Project Drop Down

I've also tried repairing Visual Studio 2022 but that didn't seem to do anything either.

UPDATE: Solution was to create a new project, select "Manage NuGet Packages" and then go back to the previous solution.

答案1

得分: 0

更新:

解决此问题的方法是创建一个新项目,选择“管理 Nuget 包”,然后返回到先前的解决方案。

在这种情况下,根本问题不是由解决方案配置引起的,而是由于 Visual Studio 中的某些问题。

原始答案:

关于您提到的问题,在 Github 中已经存在一个问题,以下是解决方法:

操作失败。在升级的 NetCore 项目中,解决方案中不支持 NuGet 的任何项目都会抛出异常

关闭并重新打开 Visual Studio,然后点击工具 -> Nuget 包管理器 -> 管理解决方案的 Nuget 包:

How do I resolve 'No projects supported by NuGet in the solution' error in Visual Studio 2022?

另外,您也可以尝试 DonMiguelSanchez 提供的方法,因为解决方案的根目录下的 .vs 文件夹包含加载的解决方案信息,如果您删除或移除此文件夹,Visual Studio 将在重新启动 Visual Studio 并打开解决方案时重新生成此文件。

英文:

Update:

The solution of this issue is to create a new project, select "Manage Nuget Packages" and then go back to the previous solution.

In this situation, the root issue doesn't cause by the solution configuration but come from something went wrong in VS.

Original Answer:

For the issue you mentioned, there have already an issue in Github, and here is the solution to it:

Operated failed. No projects supported by NuGet in the solution throws for a upgraded NetCore project

Close and reopen the Visual Studio, and then click Tools -> Nuget Package Manager -> Manage Nuget Packages for solution:

How do I resolve 'No projects supported by NuGet in the solution' error in Visual Studio 2022?

By the way, you can also try the method that DonMiguelSanchez provided, because .vs folder under the root directory of solution have information of the loaded solution, if you delete/remove this folder, Visual Studio will regenerate this file when you restart the Visual Studio and open the solution.

huangapple
  • 本文由 发表于 2023年5月22日 08:26:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/76302436.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定