Search code examples
c#stylecopauto-generate

Style Cop Auto Generated code


We are using style cop in VS2013 c# solution. I am running in to a specific scenario where the auto generated code files don't have the // tag as the header. These are the files I have in the integration test project for Workflow designer files, with code - behind auto generated files, they are re-created during the build process every single time. So adding the header doesn't help.

Is there a permanent solution to this problem?

Thanks!


Solution

  • Try adding this to your Settings.StyleCop file:

    <Parsers>
      <Parser ParserId="StyleCop.CSharp.CsParser">
        <ParserSettings>
          <CollectionProperty Name="GeneratedFileFilters">
            <Value>\\TemporaryGeneratedFile_.+\.cs$</Value>
          </CollectionProperty>
        </ParserSettings>
      </Parser>
    </Parsers>