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)?
Asked
Active
Viewed 3.0k times
4 Answers
81
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.

Stephen
- 911
- 1
- 6
- 4
-
This might not work if you want to suppress a specific warning. E.g. in my case, I would like to suppress warning MSB3270. – Farrukh Waheed Nov 27 '13 at 04:49
-
1Surprisingly helpful documentation: https://msdn.microsoft.com/en-us/library/ms164311.aspx – Ben Jan 23 '15 at 18:37
-
2It looks like this doesn't work if you're using msbuild in an Azure Devops context, as it uses the `/dl` parameter (distributedlogger) to capture logs in a way that doesn't respect the `/clp` settings, and there are no corresponding `/dlp` settings. – Alain Feb 23 '22 at 18:55
12
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

Paul Butcher
- 6,902
- 28
- 39
-
Thanks! That is exactly what happened! Also, the way software is released here requires that non-developers build from the software repositories and I want warnings to be suppressed for them. But yes, when the time presents itself the issues will be fixed. – Joseph Gordon Jan 13 '10 at 17:54
-
4
-
this is `csc` compiler CLI and it can't be used in MSBuild `msbuild -warn:0` raises error like `unknown option` – oleksa Mar 20 '20 at 08:02
-
2`msbuild /property:WarningLevel=0` [hides](https://learn.microsoft.com/uk-ua/visualstudio/msbuild/msbuild-command-line-reference?view=vs-2015&redirectedfrom=MSDN) all compiler warnings (besides MSB*). I'm using it in the Azure build pipeline to reduce msbuild log. Thinking is `/clp:ErrorsOnly` good to be used in pipeline (it hides everything besides errors) – oleksa Mar 20 '20 at 08:08
5
If you would like to suppress MSB3270 only then you can set in project file just
<PropertyGroup>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
None
</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
</PropertyGroup>

Stanislav Berkov
- 5,929
- 2
- 30
- 36
2
In Jenkins
- Happened upon this Googling "how to suppress MSBuild warnings in Jenkins"
- So much noise like the following in our console output, couldn't find the meat
Missing XML comment for publicly visible type or member
- Inherited Jenkins on a Windows server

fusion27
- 2,396
- 1
- 25
- 25
-
1This works for `dotnet build /clp:ErrorsOnly` too. While it is not a good idea to hide warning messages this can help clear up the CI logs. – nilobarp Aug 26 '22 at 04:30