Reputation: 22116
Is there a way to suppress specific build warnings for generated code behind of Web Site Visual Studio project?
Because the project is a Web Site
type project (has no project file) it is not possible to globally suppress the warnings for it under Properties
-> Build
-> Suppress Warnings
.
And since the ASPX file is being dynamically generated/compiled, using #pragma warning disable
is not possible at all.
Working solution following lurker's help:
<?xml version="1.0"?>
<configuration>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp"
extension=".cs"
type="Microsoft.CSharp.CSharpCodeProvider, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
warningLevel="4"
compilerOptions="/nowarn:108,109">
<providerOption name="CompilerVersion" value="v4.0"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
</compilers>
</system.codedom>
</configuration>
Upvotes: 0
Views: 917
Reputation: 159
There is a section in the web.config file where options to suppressing warnings are set. See the answer here: Set suppress warnings for website. There are also links to pages which have the specific values.
Upvotes: 1