[英]Using NCrunch, FxCop Analyzers and “warnings as errors”: How to configure warning severity in NCrunch?
I am coding C#.我正在编码 C#。 I use NCrunch to run my unit tests in the background.
我使用 NCrunch 在后台运行我的单元测试。 I have set in my CSPROJ files (new CSPROJ format).
我已经设置了我的 CSPROJ 文件(新的 CSPROJ 格式)。
I want to use FxCop Analyzers as NuGet packages: https://docs.microsoft.com/en-gb/visualstudio/code-quality/install-fxcop-analyzers?view=vs-2019我想将 FxCop 分析器用作 NuGet 包: https://docs.microsoft.com/en-gb/visualstudio/code-quality/install-fxcop-analyzers?view=vs-2019
When I first installed the FxCop Analyzers, my code would not build because there were a number of warnings and I have.当我第一次安装 FxCop 分析器时,我的代码无法构建,因为有很多警告,而我有。 I've downgraded a bunch of warnings to "suggestion" level by adding this to my.editorconfig:
通过将其添加到 my.editorconfig,我将一堆警告降级为“建议”级别:
dotnet_diagnostic.CA2100.severity = suggestion
Now I can build in Visual Studio.现在我可以在 Visual Studio 中构建。 But my problem is that NCrunch evidently does not read the.editorconfig file.
但我的问题是 NCrunch 显然没有读取 .editorconfig 文件。 So NCrunch fails to build the solution because it sees warnings.
因此 NCrunch 无法构建解决方案,因为它看到了警告。
How can I configure warning severity levels for NCrunch?如何为 NCrunch 配置警告严重性级别?
I have NCrunch 3.26.0.4.我有 NCrunch 3.26.0.4。
I found a solution: Apparently the.editorconfig needs to be referenced in each project (csproj file).我找到了一个解决方案:显然每个项目(csproj文件)中都需要引用.editorconfig。 I had my.editorconfig just as a "solution item".
我将 my.editorconfig 作为“解决方案项目”。 So I did this for each project:
所以我对每个项目都这样做了:
Repeat for all projects, then restart NCrunch engine.对所有项目重复此操作,然后重新启动 NCrunch 引擎。 Now NCrunch builds.
现在 NCrunch 构建。
Credit to the NCrunch forum for the solution: https://forum.ncrunch.net/yaf_postsm14118_Using-NCrunch--FxCop-Analyzers-and--warnings-as-errors---How-to-configure-warning-severity.aspx归功于 NCrunch 论坛的解决方案: https://forum.ncrunch.net/yaf_postsm14118_Using-NCrunch--FxCop-Analyzers-and--warnings-as-errors---How-to-configure-warning-severity.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.