Question

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.

Was it helpful?

Solution

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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top