How can i suppress all compiler and code analysis warnings from msbuild at the command line

msbuild

This has been asked, but wasn't answered. The answer (use /warn:1) doesn't work for msbuild.exe, only csc.exe. Perhaps I'm missing something between csc and msbuild?

I'd like to suppress all compiler warnings and code analysis warnings (e.g. "The variable 'variableNameHere' is assigned but its value …" or Code Analysis Warning : CA1805 : Microsoft.Performance : …) when I'm using command line msbuild. I don't want to alter the solution file. There are several hundred warning messages in the very large solution that I'm building — fixing them is far out of scope for my project.

I tried /v:quiet but that didn't work.

Is there any way to do this via the command line?

Update: this:

C:\WINDOWS\Microsoft.NET\Framework\v3.5\msbuild.exe C:\Dev\ReallyBigSolution.sln /p:NoWarn=true /p:NoWarn=CA1031

Absolutely doesn't work. I still get hundreds of warnings, including the one I specifically blocked (CA1031).

Using /p:RunCodeAnalysis=Never or /p:RunCodeAnalysis=false apparently doesn't suppress code analysis warnings or errors.

Best Answer

Can use nowarn flag on the compiler, which corresponds to <NoWarn> property in the .csproj file. So maybe msbuild /p:NoWarn="37;68" will turn off those warning numbers (haven't tried it).

Or use

http://msdn.microsoft.com/en-us/library/13b90fz7.aspx

to turn off warnings altogether. I don't know the property name offhand, try /p:Warn=0.

Edit: read the comments toward the end; seems like really getting rid of all these warnings isn't possible.