Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to suppress all warnings using MSBuild

How would I suppress all warnings (or at least as many as possible since those prefixed with MSB cannot be suppressed How to suppress specific MSBuild warning)?

like image 391
Joseph Gordon Avatar asked Jan 12 '10 17:01

Joseph Gordon


People also ask

How do I turn off error warnings?

You can make all warnings being treated as such using -Wno-error. You can make specific warnings being treated as such by using -Wno-error=<warning name> where <warning name> is the name of the warning you don't want treated as an error. If you want to entirely disable all warnings, use -w (not recommended).

Which number is used to suppress the warning in a code?

Use a #pragma warning (C#) or Disable (Visual Basic) directive to suppress the warning for only a specific line of code.


2 Answers

msbuild /clp:ErrorsOnly

   /consoleloggerparameters:                      Parameters to console logger. (Short form: /clp)                      The available parameters are:                         PerformanceSummary--Show time spent in tasks, targets                             and projects.                         Summary--Show error and warning summary at the end.                         NoSummary--Don't show error and warning summary at the                             end.                         **ErrorsOnly--Show only errors.**                         WarningsOnly--Show only warnings.                         NoItemAndPropertyList--Don't show list of items and                             properties at the start of each project build.                         ShowCommandLine--Show TaskCommandLineEvent messages                         ShowTimestamp--Display the Timestamp as a prefix to any                             message.                         ShowEventId--Show eventId for started events, finished                             events, and messages                         ForceNoAlign--Does not align the text to the size of                             the console buffer                         DisableMPLogging-- Disable the multiprocessor                             logging style of output when running in                             non-multiprocessor mode.                         EnableMPLogging--Enable the multiprocessor logging                             style even when running in non-multiprocessor                             mode. This logging style is on by default.                         Verbosity--overrides the /verbosity setting for this                             logger. 
like image 102
Stephen Avatar answered Sep 20 '22 22:09

Stephen


The best way is to fix the issues that are causing the warnings.

If you must ignore the warnings (e.g. you have inherited a project with so many that you can't see the wood for the trees), you could try changing the WarningLevel property, http://msdn.microsoft.com/en-us/library/13b90fz7.aspx

like image 28
Paul Butcher Avatar answered Sep 20 '22 22:09

Paul Butcher