2012-11-08 75 views
5

我想從stylecop檢查中排除/Properties/AssemblyInfo.cs。 我們可以做到嗎? 問題是我已經整合了stylecop和nant。在我不能打印產品版本,所以來自程序集信息的信息會發生變化,並會在電子郵件中發出警告。我正在使用stylecopcmd 進行整合。從stylecop檢查中排除文件

回答

9

有幾種方法可以做到這一點。推薦的方法是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>