views:

33

answers:

1

I'm trying to be a good dev and turn on treat warnings as errors (as I have always done in the past). The biggest difference is that this time, I'm using Silverlight 4 which generates a ton of code. All of the code starts something like this:

#pragma checksum <some stuff>
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.1
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//---------

However, the treat warnings as errors is not ignoring it. I was under the impression that including such a header would cause the file to be ignored. Apparently, I'm wrong. Does anyone have a (clean) suggestion?

A: 

Okay, so it turns out that, at least in my case, the only warnings coming from the generated files were resulting from my creation of a custom base Silverlight page that my pages inherited from. You can fix the issue of compiler warnings resulting from this type of scenario by removing the XAML file from the project and re-adding the xaml.cs code-behind file back to the project. This causes the LayoutRoot to not be defined, and the code generator to not generate the InitializeComponent method for this base class. Hopefully this will help someone else, too!

David Moye