Treat Warnings as Errors in ASP.NET 2.0

Friday, August 11, 2006

The web.config file controls all compilation settings in a default web site project. To treat compiler warnings as errors, you'll need the following in web.config:

<system.codedom>
  <
compilers>
    <
compiler            
      
language="c#;cs;csharp" extension=".cs"
      
compilerOptions="/warnaserror"
       type="Microsoft.CSharp.CSharpCodeProvider,
             System, Version=2.0.0.0, Culture=neutral,
             PublicKeyToken=b77a5c561934e089
" />
  </
compilers>
</
system.codedom>

Note: You can only twiddle with compiler settings under full trust, but then you'll only need this setting at build time.


Comments
Comments are now closed.
Follow Me On Twitter
RSS Subscribe
Contact
Search Archives
by K. Scott Allen
K.Scott Allen