Exclude file from StyleCop analysis: "auto-generated" tag is ignored

Daniel Daranas picture Daniel Daranas · Feb 17, 2011 · Viewed 19.1k times · Source

At the beginning of a C# file, I have added:

//-----------------------------------------------------------------------
// <copyright company="SomeCompany" file="MyFile.cs">
// Copyright © Some Company, 2011
// </copyright>
// <auto-generated />
//-----------------------------------------------------------------------

I want StyleCop to skip checking this file, so I used the auto-generated trick explained in other answers.

However, after cleaning and rebuilding my solution, StyleCop keeps generating warnings for this file. Why does this happen? How can it be fixed?

I am using Microsoft Visual Studio 2008 Professional Edition and StyleCop v4.3.

Answer

Oleg Shuruev picture Oleg Shuruev · Feb 17, 2011

@Frédéric - unfortunately, Analyze generated files option is not somehow connected with skipping files with <auto-generated /> tag.

Files containing <auto-generated /> text will always be skipped regardless the value of the setting.

@Daniel - I believe that you deal with a bug in version 4.3 which was released more than a year ago and is definitely obsolete now. The only reason to use 4.3 is only if you use Visual Studio 2005, which is not supported by StyleCop 4.4.

I strongly recommend you upgrading to 4.4 - I've just checked your example and it works fine.