After upgrading to VS 2010 MSBUILD /p:RunCodeAnalysis=true does not work as expected
msbuild solution.sln /p:RunCodeAnalysis=true
To get faster builds we removed the CODE_ANALYSIS constant for the DEBUG build. But that means thet when running the above msbuild command, it defauls to all rules, instead of using the ruleset we specified in on the "Code Analysis" tab on the project property page.
So now I need to build in release mode to run code analasis (which has the CODE_ANALYSIS constant defined):
msbuild solution.sln /p:RunCodeAnalysis=true /p:Configuration=release
This however means we get a release build on our dev machines. And this has some side effects in our setup.
Question: How do I specify the rulset from a command line. I was hoping something like:
msbuild solution.sln /p:RunCodeAnalysis=true /p:foobar=rules.ruleset
Create a custom rule set from an existing rule setIn Solution Explorer, right-click the project and then select Properties. On the Properties pages, select the Code Analysis tab. In the Active rules drop-down list, do one of the following: Choose the rule set that you want to customize.
A rule set is a grouping of code analysis rules that identify targeted issues and specific conditions for that project. For example, you can apply a rule set that's designed to scan code for publicly available APIs. You can also apply a rule set that includes all the available rules.
You'll have to use the CodeAnalysisRuleSet
property.
msbuild solution.sln /p:RunCodeAnalysis=true;CodeAnalysisRuleSet=GlobalizationRules.ruleset
Here is the predefined ruleset list :
AllRules.ruleset
BasicCorrectnessRules.ruleset
BasicDesignGuidelineRules.ruleset
ExtendedCorrectnessRules.ruleset
ExtendedDesignGuidelineRules.ruleset
GlobalizationRules.ruleset
MinimumRecommendedRules.ruleset
SecurityRules.ruleset
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With