在 TFS 2010 构建中指定代码分析设置
在 TFS 2010 的构建定义中,当“执行代码分析”设置为“始终”时,如何指定自定义代码分析规则文件?
构建风格是“Release”。
我不喜欢为“执行代码分析”设置“AsConfigured”,以便从 proj 文件中选取设置。
谢谢。
In the build definition of TFS 2010, when "Perform Code Analysis" set to "Always" how can I specify a custom code analysis rules file?
The build flavour is "Release".
I prefer not to set "AsConfigured" for "Perform Code Analysis" so that the settings are picked from proj file.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该能够在构建过程参数配置中使用“MSBuild Arguments”条目来提供将传递给 MSBuild 的
/property
命令行条目,从而允许覆盖CodeAnalysisRuleSet< /code> 要应用的属性值。
根据您在现有项目中设置 CodeAnalysisRuleSet 属性值的方式,您可能还需要调整值分配,以预先存在的值为空为条件。如果您需要这样做,您可能需要考虑借此机会将所有项目的代码分析配置移动到单独的 .targets 文件中,以便将来可以更轻松地对其进行调整。
You should be able to use the "MSBuild Arguments" entry in your build process parameters configuration to provide a
/property
command line entry that will be passed to MSBuild, thereby allowing override of theCodeAnalysisRuleSet
property value to be applied.Depending on how you have set up the CodeAnalysisRuleSet property values in your existing projects, you may also need to tweak the value assignments to be conditional on the pre-existing value being empty. If you need to do this, you might want to consider taking the opportunity to move the code analysis configuration for all projects into a separate .targets file so that they can be tweaked more easily in the future.
如果切换到始终
,我认为您无法指定自定义代码分析规则集文件。(基于Nicole 的回答)
我认为如果您将操作设置为
始终
使用为当前构建风格分配的规则集文件。基于此,您需要使用 VS 将自定义规则集文件分配给您的项目,如所述 此处 或通过
菜单->分析->为解决方案/项目配置代码分析
。I dont think you can specify a custom code analysis ruleset file if you switch toAlways
.(based on Nicole's answer)
I think if you set the action to
Always
the assigned ruleset file for the current build flavor is used.Based on this you need to assign the custom ruleset file with VS to your projects like discribed here or via
menu->Analyze->Configure Code Analysis for Solution/Projects
.