某些项目的依赖项包含无法解释的代码分析器 [英] Some projects' dependencies contain unexplained code analyzers

查看:49
本文介绍了某些项目的依赖项包含无法解释的代码分析器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个项目,在 Dependencies 下有一个或两个这样的代码分析器分支:

我按照

我不知道它们来自哪里.有些项目有它们,有些则没有.但是,它们似乎与安装在这些项目中的 ASP.NET CoreMVC 包有关.

解决方案

我通过删除 microsoft.codeanalysis.analyzers 文件夹并执行 nuget restore 修复了警告.它们仍然在 Dependencies 下,但至少感叹号消失了.

我还通过将 <ExcludeAssets>analyzers</ExcludeAssets> directive 添加到每个 AspNetCore 包中,设法删除了分析器:

<ExcludeAssets>分析器</ExcludeAssets></PackageReference><PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" 版本="2.1.1" ><ExcludeAssets>分析器</ExcludeAssets></PackageReference>

现在他们终于走了.

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.

解决方案

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.

这篇关于某些项目的依赖项包含无法解释的代码分析器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆