FxCop and generated code

less than 1 minute read

If you struggle with FxCop complaining about code that was generated for you, say from WSDL or XSD, then help is (well, will be) at hand. In .NET 2.0 (RTM), the tools generating this code will introduce a [GeneratedCode] attribute that signals to FxCop that it should relax its rules. Since you don’t have any control over the generated code, FxCop is really generally useful for the times when you can do something to fix the warning you’re being given. If you write your own tools that generate code, you’ll be able to emit this attribute in the same way.