VS2019 ASP.NET MVC "Cannot navigate to the symbol under caret"

VS2019 ASP.NET MVC "Cannot navigate to the symbol under caret"

在 Visual Studio 2019 中打开现有的 ASP.NET MVC 项目时,我在尝试 "Go To Definition" (F12) 时一直收到此错误消息 "Cannot navigate to the symbol under caret"。

None "Cannot navigate to the symbol under caret" 的其他答案解决了我的问题,直到我从 visual studio 开发者社区找到了这个解决方案。

这是link,下面是post的解决方案:https://developercommunity.visualstudio.com/content/problem/505489/cannot-navigate-to-the-symbol-under-the-caret-3.html

This is happening to projects that are using v1.0.0 of Microsoft.Net.Compilers. To work around this problem you need to update to the latest stable version which is 3.0.0. To do that you can follow the these steps:

1) Right click on "References" in the Solution Explorer

2) Select "Manage NuGet Packages"

3) Under the "Installed" tab search fro "Microsoft.Net.Compilers"

4) Select "Microsoft.Net.Compilers"

5) On the side window of "Microsoft.Net.Compilers" click the update button

That should allow you navigate to definitions