Visual Studio:暂时禁用 StyleCop [英] Visual Studio: temporarily disable StyleCop
本文介绍了Visual Studio:暂时禁用 StyleCop的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你能在 VS 中禁用 styleCop 吗?
Can you disable styleCop in VS?
场景:
- 按禁用 StyleCop"按钮
- 运行/调试一些测试代码
- 按钮自动,再次启用 StyleCop.因此,如果您想在没有 StyleCop 的情况下运行,您必须再次主动禁用它.
推荐答案
我已经设置了一个不运行代码分析的单独构建配置.
I've setup a separate build configuration that doesn't run code analysis.
我现在在 VS 中有以下配置:
I now have the following configurations in VS:
- 发布
- 调试
- 调试(无代码分析)
您必须手动选择要构建的配置(即列表中的第 3 步是手动步骤)
You have to manually choose which configuration you want to build (i.e. step 3 in your list would be a manual step)
在构建目标文件中,我包含了以下几行代码:
In the build targets file I've included code along these lines:
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug (No code analysis)' ">
<RunCodeAnalysis>false</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup>
<DefineConstants Condition="('$(RunCodeAnalysis)'=='true') and '$(Language)'=='C#' ">CODE_ANALYSIS;$(DefineConstants)</DefineConstants>
</PropertyGroup>
这篇关于Visual Studio:暂时禁用 StyleCop的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文