Msbuild警告不会破坏构建

问题描述 投票:0回答:1

执行MSbuild任务(在TFS2017下)后,使用以下参数:

/m /property:StyleCopTreatErrorsAsWarnings=false /property:StyleCopEnabled=true /p:SkipInvalidConfigurations=true

编译成功。警告显示在Summary / build下,但我的期望是编译必须以错误结束。

警告是:

警告:CA1822:Microsoft.Performance:'this'参数(或Visual Basic中的'Me')...

MsBuild参数设置不正确吗?

msbuild tfs2017 msbuild-task vnext
1个回答
0
投票

默认情况下,所有代码分析规则 - 警告。您必须为关键规则设置错误属性:

  1. 选择代码分析:

enter image description here

  1. 更新规则属性:

enter image description here

  1. 那将为你的项目生成一个新的规则集文件

enter image description here

  1. 你得到一个失败的构建

enter image description here

您也可以创建任何自定义规则集并将其用于您的构建:How do I specify a ruleset from MSBuild

© www.soinside.com 2019 - 2024. All rights reserved.