如何使用MSBuild抑制所有警告

时间:2010-01-12 17:12:41

标签: command-line msbuild

如何抑制所有警告(或至少尽可能多的警告,因为那些以MSB为前缀的警告无法被抑制How to suppress specific MSBuild warning)?

4 个答案:

答案 0 :(得分:62)

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.

答案 1 :(得分:13)

最好的方法是解决导致警告的问题。

如果您必须忽略警告(例如,您继承了一个项目很多,以至于您无法看到树木的木材),您可以尝试更改WarningLevel属性,http://msdn.microsoft.com/en-us/library/13b90fz7.aspx

答案 2 :(得分:5)

如果您只想抑制MSB3270,那么您可以在项目文件中设置

<PropertyGroup>
  <ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
    None
  </ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
</PropertyGroup>

答案 3 :(得分:0)

在詹金斯

  • 发生在谷歌搜索“如何在詹金斯中抑制MSBuild警告”
  • 在控制台输出中有很多类似以下的声音,找不到肉
    Missing XML comment for publicly visible type or member
    
  • 在Windows服务器上继承的Jenkins

  1. 管理Jenkins>全局工具配置> MSBuild
  2. /clp:ErrorsOnly 添加到默认参数 enter image description here