在 Visual Studio 2019 年重新安装 Nuget 包管理器

Reinstall Nuget Package Manager in Visual Studio 2019

我的项目遇到了问题。

The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?

这以前发生过,我通过使用命令重新安装 Nuget 包管理器解决了这个问题。不幸的是,我再也找不到那个命令了。我试图在网上找到解决方案,但我得到的只是 installing/reinstalling NuGet 包而不是包管理器。

找到这篇文章:https://forums.asp.net/t/1776324.aspx?How+to+install+upgrade+VS+NuGet+Package+Manager+ 但它不适用于此处。

NuGet 包管理器预装在 VS2019 中,无需下载和安装单独的包。此外,VS2019 中没有像旧版本那样的扩展管理。

请告诉我在 Visual Studio 2019 年重新安装 NuGet 包管理器的命令。

此类 nuget 恢复问题通常可以通过删除 project.assets.jsonprojectname.csproj.nuget.g.targetsprojectname.csproj.nuget.g.propsprojectname.csproj.nuget.dgspec.json 和 [=14= 等 nuget 文件所在的 obj 文件夹来解决] 被存储。

如果仍然不能解决问题,请删除解决方案中的 hidden .vs folder,其中 Visual Studio 存储项目的用户设置。