【发布时间】:2017-10-13 21:44:26
【问题描述】:
我在 .Net 4.5.2 上构建的 csproj Project1 上的 VS 2017 Enterprise 中看到以下内容:
18>------ Rebuild All started: Project: Project1, Configuration: Debug Any CPU ------
18>C:\git\27844-2-StyleCop\company\Class1.cs(26,31,26,47): warning CS0169: The field 'Class1.field' is never used
18>C:\git\27844-2-StyleCop\company\Class2.cs(31,48,31,69): warning SA1214: Readonly fields must appear before non-readonly fields
18>C:\git\27844-2-StyleCop\company\Interface1.cs(9,45,9,69): warning SA1127: Generic type constraints must be on their own line
18> Project1 -> C:\git\27844-2-StyleCop\company\Project1\Project1\bin\Debug\Project1.dll
18> Running Code Analysis...
18> Code Analysis Complete -- 0 error(s), 0 warning(s)
显然,内置 C# DotNetAnalyzers 和 StyleCop.Analyzers 1.0.2 版的组合会收到 3 个警告。我想知道为什么:
18> Code Analysis Complete - 0 error(s), 0 warning(s)
部分不是:
18> Code Analysis Complete - 0 error(s), 3 warning(s)
以及为什么代码分析日志文件Project1.dll.CodeAnalysisLog.xml
我试过了:
- 在项目属性中关闭/打开
Enable Code Analysis on Build - 在项目属性中关闭/打开
Treat Warnings as Errors - 确保项目属性中没有
Suppress warnings - 确保我使用的规则集在我构建的配置/平台上运行
- 清洁/重建
- 在项目中明确运行代码分析
我做错了吗?
【问题讨论】:
标签: c# visual-studio-2017 .net-4.5 code-analysis roslyn-code-analysis