t3c*_*b0t 5 c# projects-and-solutions roslyn-code-analysis
I have a couple of projects where under Dependencies there are one or two branches of code analyzers like this:
I tried the right mouse click on every branch as explaind here but there is no option to configure them and I also searched for *.ruleset files insinde the solution, I also check the packages as shown in the docs but there is nothing like that anywhere.
There is also nothing suspicious in the .csproj files, just some nuget packages that I've installed but nothing analyzer related.
How do I get rid of them? They give me warnings when I reference such projects in other solutions and nuget restore doesn't fix it either:
I have no idea where they come from. Some projects have them and others don't. However, they seem to somehow be related to ASP.NET Core or MVC packages that are installed in those projects.
Visual Studio 中存在一个错误,预计很快就会修复。当 Visual Studio 加载解决方案的所有项目并尝试解析所有依赖项以在解决方案资源管理器中显示时,某些依赖项可能会失败并显示为警告,并显示依赖项的可能文件的路径。
解决方法:
右键单击带有警告的项目,然后Unload Project在菜单中选择 。然后再次右键单击它并选择Reload Project。由于 Visual Studio 的后台进程不像加载整个解决方案的所有内容时那么繁忙,因此它很可能会解决依赖性。它似乎总是对我有用。
我通过删除文件夹microsoft.codeanalysis.analyzers并执行nuget restore. 它们仍然在下面Dependencies,但至少感叹号消失了。
我还通过向每个包添加<ExcludeAssets>analyzers</ExcludeAssets> 指令来删除分析器AspNetCore:
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.1.3">
<ExcludeAssets>analyzers</ExcludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.1.1" >
<ExcludeAssets>analyzers</ExcludeAssets>
</PackageReference>
Run Code Online (Sandbox Code Playgroud)
现在他们终于走了。