问题
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.
回答1:
I've fixed the warnings by deleting the microsoft.codeanalysis.analyzers
folder and executing nuget restore
. They are still under Dependencies
but at least the exclamation marks are gone.
I've also managed to remove the analyzers by adding the <ExcludeAssets>analyzers</ExcludeAssets>
directive to each AspNetCore
package:
<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>
Now they're finally gone.
回答2:
Search Gcop in nuget package manager removes the installed packages prefixed with GCop. this will remove the code analyzer references from your project
来源:https://stackoverflow.com/questions/53542703/some-projects-dependencies-contain-unexplained-code-analyzers