在 TFS 级别 VS2017 上将警告视为错误 [英] Treat Warnings as Errors on TFS level VS2017
问题描述
我已经为此苦苦挣扎了一段时间.我已经搜索并尝试了不同的东西,但它不起作用,所以我在这里发布.
我想在 TFS 级别构建时将警告视为错误,但此选项无效.
我已经按照其他帖子的建议做了:我尝试过:/p:TreatWarningsAsErrors=true和/p:TreatWarningsAsErrors="true"
I have been struggling with this for a while. I have searched and tried different things but it does not work, so I am posting this here.
I want to treat warnings as errors when building on TFS level and this option has not been working.
I have done it like suggested on other posts: I have tried: /p:TreatWarningsAsErrors=true and /p:TreatWarningsAsErrors="true"
Enabling TreatWarningsAsErrors
However, that as been unsuccessful as when building I have the following result: The warning is not treated as error on TFS build.
The build is successful As the image below shows and there are no errors.
Can anyone help me with insight on this about how to do it?
Update: Obs: I do know the option to set TreatWarningAsErrors on the properties of the project when using VS2017 and that works, as warning are treated as errors there, but that does not work for TFS.
TreatWarningAsError on VS2017 project properties
I have enabled treat warnings as errors in VS2017, under project properties, for both Debug and Release.
I tested at my side, the argument /p:TreatWarningsAsErrors="true"
works for me:
Note that if you have enabled the Treat Warnings As Errors
in VS (set to ALL
or Specific Warnings
) for the project, then you don't need to add the argument /p:TreatWarningsAsErrors="true"
anymore.
So, you can try below things to narrow down the issue:
- Enable the option (Set to
All
), then check in changes, then build again. - Disable the option (set to
None
, just keep it as default), clean caches for your client server, then create a new build definition, add the argument/p:TreatWarningsAsErrors="true"
in build step. Queue a build to check if that works for you.
UPDATE:
As Kevin mentioned in below comment, the problem is that SonarQube
seems to be interfering somehow.... Just created a new build definition identical to the first one but without SonarQube Analysis and the warnings became errors in the build of the solution.
这篇关于在 TFS 级别 VS2017 上将警告视为错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!