Specifying code analysis setting in TFS 2010 build

心已入冬 提交于 2020-01-03 04:09:27

问题


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.


回答1:


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 the CodeAnalysisRuleSet 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.




回答2:


I dont think you can specify a custom code analysis ruleset file if you switch to Always.

(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.



来源:https://stackoverflow.com/questions/8726519/specifying-code-analysis-setting-in-tfs-2010-build

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!