的MSBuild:把单一的警告当作错误 [英] MSBuild: Treat single warning as error

查看:485
本文介绍了的MSBuild:把单一的警告当作错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法强制MSBuild的治疗有一定的警告作为一个错误?

在运行发布目标的ccproj文件进行部署到Azure中的cspkg,引发此错误:

When running the Publish target for a ccproj file to make a cspkg for deployment to Azure, this error is thrown:

Project.Name:警告WAT150:该项目的Project.Name'是
  依赖于以下组件:
  C:\\ WINDOWS \\装配\\ GAC_64 \\ DLLNAME \\ 2.10.0.0__Guid \\ DllName.dll。这个
  组件不是在包中。为了确保角色开始,添加
  本次大会作为对项目的引用,设置复制本地
  属性设置为true。
  [C:\\ BLD \\ 66 \\ 797 \\ \\源应用程序\\云\\ Project.Name.ccproj]

Project.Name : warning WAT150: The project 'Project.Name' is dependent on the following assembly: C:\Windows\assembly\GAC_64\DllName\2.10.0.0__Guid\DllName.dll. This assembly is not in the package. To make sure that the role starts, add this assembly as a reference to the project and set the Copy Local property to true. [C:\bld\66\797\Sources\Applications\cloud\Project.Name.ccproj]

这是这可能意味着一个角色将无法启动部署时......我想打WAT150错误警告。 有没有一种方法,使一个具体的,单一的警告或警告的列表错误?

This is a warning that probably means a role won't start when deployed... I'd like to make WAT150 an error. Is there a way to make a specific, single warning or list of warnings an error?

推荐答案

在你有这样的MSBuild的命令行选项:

in the msbuild commandline options you have this:

warningsAsErrors

warningsAsErrors

指定要当作错误警告的列表。该参数是相当于/ warnaserror将编译器开关

Specifies a list of warnings to treat as errors. This parameter is equivalent to the /warnaserror compiler switch.

文档链接:的http:/ /msdn.microsoft.com/en-us/library/vstudio/bb629394(v=vs.100).aspx

这篇关于的MSBuild:把单一的警告当作错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆