【问题标题】:Exclude file from stylecop checking从 stylecop 检查中排除文件
【发布时间】:2012-11-08 08:54:48
【问题描述】:
我想从 stylecop 检查中排除 /Properties/AssemblyInfo.cs。
我们可以这样做吗?
问题是我已经将 stylecop 与 nant 集成在一起。在 nant 中,我正在标记产品版本,因此来自 Assembly info 的信息会发生变化,并在 nant 电子邮件中发出警告。我正在使用 stylecopcmd
用于 nant 集成。
【问题讨论】:
标签:
cruisecontrol.net
nant
stylecop
【解决方案1】:
有几种方法可以做到这一点。推荐的方法是file lists。这是一个例子:
<StyleCopSettings Version="4.3">
<SourceFileList>
<SourceFile>AssemblyInfo.cs</SourceFile>
<Settings>
<GlobalSettings>
<BooleanProperty Name="RulesEnabledByDefault">False</BooleanProperty>
</GlobalSettings>
</Settings>
</SourceFileList>
</StyleCopSettings>
或者,您可以使用项目文件中的ExcludeFromStyleCop 设置,如here 所述:
<Compile Include="AssemblyInfo.cs">
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
</Compile>