禁用code分析警告.NETcode、NET

由网友(請把小熊还给我)分享简介:在视觉工作室,我可以运行在我的.NET项目code分析。我运行的基本正确性,并有85警告。这是一个有点多。另外大部分是外code。如何禁用特定的警告,这样我可以专注于更重要的警告?我想下面的,但它不承认code分析警告。 (我第一次尝试W / O型的CA)的#pragma警告禁止CA1820 CA1065 CA2100...

在视觉工作室,我可以运行在我的.NET项目code分析。我运行的基本正确性,并有85警告。这是一个有点多。另外大部分是外code。

如何禁用特定的警告,这样我可以专注于更重要的警告?我想下面的,但它不承认code分析警告。 (我第一次尝试W / O型的CA)

 的#pragma警告禁止CA1820 CA1065 CA2100
 

解决方案 delphi7无法编译已经使用的单元怎么解决 使用VS Code 开发.NET Core程序指南

您需要复制一个code分析规则集,并停用你不喜欢的规则。

转至项目属性,选择一个规则集,从开始,然后单击打开。 取消选中,你不喜欢规则,然后单击另存为。 最后,选择该规则在项目属性进行设置。

您也可以从头开始,通过右键单击该项目或解决方案,然后单击添加新项,$ C C分析规则集$。

In visual studios i can run code analysis on my .NET project. I am running basic correctness and have 85 warnings. Which is a little much. Also majority of them are in external code.

How do i disable specific warnings so i can focus on the more important warnings? I tried the below but it does not recognize code analysis warnings. (I first tried w/o the CA)

#pragma warning disable CA1820 CA1065 CA2100

解决方案

You need to copy a code analysis ruleset and disable the rules you don't like.

Go to the Project Properties, select a ruleset to start from, then click Open. Uncheck the rules that you don't like, then click Save As. Finally, select that rule set in Project Properties.

You can also start from scratch, by right-clicking the project or solution and clicking Add New Item, Code Analysis Rule Set.

阅读全文

相关推荐

最新文章