Question

I'm developing a C# project which includes a SqlMetal generated file. I'd like to use Code Analysis. I've turned on "Suppress results from generated code" in the Code Analysis options, but it still reports on the SqlMetal classes. Is there some way to turn this off?

I'm using Visual Studio 2008 and SqlMetal 2.0.50727.3082

Was it helpful?

Solution

One option is to edit the generated source to simply add "partial" to the classes you care about.

Then you can add in a separate file(s)

[GeneratedCode]
public partial class Foo
{
}

for every class Foo you made partial

Then the worst that can happen on regeneration is that the partial link becomes broken (which will result in a compile error so you know that this has happened and needs correcting (simply and easily).

I would also suggest you file a connect bug/request asking for them to add this attribute generation as an option on sql metal itself.

OTHER TIPS

This is a known issue (but sadly the correction is postponed to the next version after Visual Studio 2010) :

http://connect.microsoft.com/VisualStudio/feedback/details/470206/code-analysis-and-designer-files

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top