问题
I have what is basically a default ASP.NET Core 2.2 project created from the default Razor Pages templates.
Now, in solution explorer -> Dependencies there is a node called "Analyzers".
First of all, at first I had no idea what it was for. I think I know now but it's still kind of fuzzy.
Secondly, why does it have a warning icon? Same with its child nodes.
Note: I'm not under the "NuGet" node, so this is not a question about missing dependencies or anything like that.
And thirdly; why is this "feature" there if it's only there to confuse me?!
回答1:
I had the same issue. After I restarted Visual Studio with Administrator privileges, Analyzers titles started to show the name instead of the path and the "warning" is gone.
EDIT
There is a GiHub issue about it.
A temporary fix would be to close the solution and to delete .dtbcache file in the .vs folder.
回答2:
The warnings under each analyzer assembly are issues found in your code. Found by rules in those assemblies.
With the introduction of the Roslyn compilers it has become easier to analyse your sourcecode even before the compiler runs. These rules are packaged in special nuget packages. When these rules run they show in the error window and in this list.
If a rule misbehaves, or you want to turn it off or you want to look at just the MVC rules, this view is quite useful.
When analyzers themselves run into issues (some are not as good as others) the respective issues are also shown here. It looks like the RS* rules are actually issues with the rules themselves.
回答3:
In my case, the warnings disappeared after I set net core 3.1 as target framework in project properties.
来源:https://stackoverflow.com/questions/56010691/analyzers-warnings-in-asp-net-core-2-2-project-in-vs2019