简体   繁体   English

Visual Studio 2022 显示所有错误

[英]Visual Studio 2022 showing errors for everything

I updated Visual Studio 2022 Pro this morning to version 17.2.6我今天早上将 Visual Studio 2022 Pro 更新到版本 17.2.6

When it finished updating, I opened my project and nearly every line of any file I opened suddenly had errors for things like not recognizing strings as System.String or void as System.Void.当它完成更新时,我打开了我的项目,我打开的任何文件的几乎每一行都突然出现错误,例如无法将字符串识别为 System.String 或将 void 识别为 System.Void。 At one point it was showing 24,000 errors with only 1 file open.在某一时刻,它仅显示 1 个文件打开了 24,000 个错误。

I tried repairing visual studio, restarting my computer, modifying the program with anything that seemed helpful, but nothing fixed it.我尝试修复 Visual Studio,重新启动计算机,用任何看起来有用的东西修改程序,但没有任何修复。

Importantly, whenever I built the solution, all the projects would succeed and it could run.重要的是,每当我构建解决方案时,所有项目都会成功并且可以运行。

The problem was that visual studio was looking in the wrong location for the code analyzer assembly.问题是 Visual Studio 正在寻找代码分析器程序集的错误位置。 To fix this, right click on the solution in the solution explorer and select Manage NuGet Packages for Solution.要解决此问题,请右键单击解决方案资源管理器中的解决方案,然后选择“管理解决方案的 NuGet 包”。 Update all your packages and the errors should go away更新所有软件包,错误应该消失

删除.vs文件夹或仅删除.vs\<solution_name>\v17 .suo文件夹中的 .suo 文件。

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

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