Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exclude file from stylecop checking

I want to exclude /Properties/AssemblyInfo.cs from stylecop checking. Can we do that? the problem is that i have integrated stylecop with nant. In nant i am stamping product version so the information from Assembly info changes and it gives warning in nant email. I am using stylecopcmd for nant integration.

like image 635
Rahul Rajput Avatar asked Nov 08 '12 08:11

Rahul Rajput


1 Answers

There are a couple of ways to do this. The recommended method is with file lists. Here is an example:

<StyleCopSettings Version="4.3">
  <SourceFileList>
    <SourceFile>AssemblyInfo.cs</SourceFile>
    <Settings>
    <GlobalSettings>
      <BooleanProperty Name="RulesEnabledByDefault">False</BooleanProperty>
    </GlobalSettings>
    </Settings>
  </SourceFileList>
</StyleCopSettings>

Alternatively you can use the ExcludeFromStyleCop setting in the project file as documented here:

<Compile Include="AssemblyInfo.cs"> 
  <ExcludeFromStyleCop>true</ExcludeFromStyleCop> 
</Compile>
like image 93
Mightymuke Avatar answered Sep 18 '22 06:09

Mightymuke