[英]What's the difference between Microsoft.CodeAnalysis.FxCopAnalyzers and Microsoft.CodeAnalysis?
I want to install code analysis in one of my C# projects, and it seems that the way people add code analysis to .NET Core projects is by using the NuGet package Microsoft.CodeAnalysis.FxCopAnalyzers
.我想在我的一个 C# 项目中安装代码分析,似乎人们将代码分析添加到 .NET Core 项目的方式是使用 NuGet 包
Microsoft.CodeAnalysis.FxCopAnalyzers
。
However, I also found other NuGet packages from the Microsoft.CodeAnalysis
namespace, namely Microsoft.CodeAnalysis
, Microsoft.CodeAnalysis.CSharp
, Microsoft.CodeAnalysis.Features
, etc.但是,我还从
Microsoft.CodeAnalysis
命名空间中找到了其他 NuGet 包,即Microsoft.CodeAnalysis
、 Microsoft.CodeAnalysis.CSharp
、 Microsoft.CodeAnalysis.Features
等。
What is the purpose of these other packages in comparison to the FxCopAnalyers
package?与
FxCopAnalyers
包相比,这些其他包的用途是什么? The package descriptions are not very clear, so I don't know what their use cases are.包的描述不是很清楚,所以我不知道他们的用例是什么。
EDIT 2021: From current documentation : Prior to Visual Studio 2019 16.8 and .NET 5.0, code analyzers shipped as Microsoft.CodeAnalysis.FxCopAnalyzers
NuGet package.编辑 2021:根据当前文档:在 Visual Studio 2019 16.8 和 .NET 5.0 之前,代码分析器作为
Microsoft.CodeAnalysis.FxCopAnalyzers
NuGet 包提供。 Starting in Visual Studio 2019 16.8 and .NET 5.0, these analyzers are included with the .NET SDK.从 Visual Studio 2019 16.8 和 .NET 5.0 开始,这些分析器包含在 .NET SDK 中。 They are also available as
Microsoft.CodeAnalysis.NetAnalyzers
NuGet package.它们也可用作
Microsoft.CodeAnalysis.NetAnalyzers
NuGet 包。 Please consider migrating from FxCop analyzers to .NET analyzers.请考虑从 FxCop 分析器迁移到 .NET 分析器。
Microsoft.CodeAnalysis.FxCopAnalyzers is just a set of analyzers which analyze your code as some other analyzers, IDEs, etc. This package analyzes your code for performance, design issues, and so on, and so forth. Microsoft.CodeAnalysis.FxCopAnalyzers只是一组分析器,可以像其他一些分析器、IDE 等一样分析您的代码。此包分析您的代码的性能、设计问题等。
However, Microsoft.CodeAnalysis.CSharp , Microsoft.CodeAnalysis.VisualBasic , Microsoft.CodeAnalysis.Workspaces and other similar packages allow you to programmatically analyze input code, write custom static code analyzers and rulesets, investigate semantic and syntactical code models, and use some helpful logic to extend Visual Studio features, and so on, and so forth.但是, Microsoft.CodeAnalysis.CSharp 、 Microsoft.CodeAnalysis.VisualBasic 、 Microsoft.CodeAnalysis.Workspaces和其他类似包允许您以编程方式分析输入代码、编写自定义静态代码分析器和规则集、研究语义和句法代码模型,并使用一些有用的用于扩展 Visual Studio 功能的逻辑等等。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.