I'm trying to get msbuild to output code analysis info like it does in VS. I have a configuration for my project called "CodeAnalysis" in VS that is set up to run code analysis on build (with the minimum ruleset). Anyway this is working fine in VS, but when I run msbuild from the command line it only shows the basic build warnings and it doesn't run code analysis at all. Anyone know why this is happening?
Configuration in project file:
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'CodeAnalysis|AnyCPU'">
<OutputPath>bin\</OutputPath>
<CodeAnalysisRuleSet>C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\Rule Sets\MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
Command line:
msbuild Solution.sln /p:Configuration=CodeAnalysis /t:Rebuild
I also tried:
msbuild Solution.sln /p:RunCodeAnalysis=true /t:Rebuild
By default, MSBuild uses the value configured in the project file, but you can override it on the msbuild
command-line using the argument
/p:RunCodeAnalysis=true
to always run code analysis. Vice versa, use
/p:RunCodeAnalysis=false
to disable code analysis.
See also: