门控签入构建忽略源代码中的 [SuppressMessage]
我们想要拒绝违反我们自定义的静态代码规则的签入。因此,我们定义了门控签入构建,并将“执行代码分析”设置为“AsConfigured”。
当我在本地构建解决方案时,使用与构建中的门控检查定义的相同配置和目标,没有错误。但门控签入构建似乎忽略了我们在源代码中定义的任何 [SuppressMessage] 属性,从而报告错误。
门控签入构建不会忽略 GlobalSuppressions 文件中定义的 [SuppressMessage] 属性。
还有人有这个问题吗?
We want to refuse checkins which break our custom defined static code rules. Therefore we have defined a Gated Checkin build, with "Perform Code Analysis" set to 'AsConfigured'.
When I build the solution locally, using the same configuration and target as defined for the Gated Check in build, there are no errors. But the Gated Checkin build seems to ignore any [SuppressMessage] attributes that we have defined in source, thus reporting errors.
The Gated checkin build does not ignore [SuppressMessage] attributes that are defined in a GlobalSuppressions file.
Any one else have this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当你说你在本地构建得很好时,你是从 Visual Studio 构建的,还是使用 MSBuild 构建的?
TFS Build 使用 MSBuild 来构建项目,您应该能够通过查看构建报告中的日志来了解构建期间运行的 MSBuild 命令(如果您将详细级别至少设置为“正常”)。
要调查此问题,我建议您使用此 MSBuild 命令在本地构建解决方案(您需要更改计算机上解决方案的路径,而不是构建计算机上使用的路径),它可能会给您相同的错误,这表明使用 MSBuild 构建和使用 Visual Studio 构建之间存在差异。然后我们可以查看 MSBuild 命令并了解为什么它的行为方式不同。
希望这有帮助。
When you said you build locally fine, did you build from Visual Studio, or did you build with MSBuild?
TFS Build uses MSBuild to build the projects, and you should be able to see what MSBuild command is run during the build by looking the log from the build report (if you set the verbosity level at least to Normal).
To investigate this issue, I would recommend you use this MSBuild command to build your solution locally (you would need to change the path to the solution on your machine, rather than the path used on the build machine), and it will likely give you the same errors, which indicates a discrepancy between building with MSBuild and building with Visual Studio. Then we can look at the MSBuild command and see why it does not behave the same way.
Hope this helps.