如何抑制所有警告(或至少尽可能多的警告,因为那些以MSB为前缀的警告无法被抑制How to suppress specific MSBuild warning)?
答案 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)