Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify CodeAnalysisRules in MSBuild via commandline

I want to be able to specify the Code AnalysisRules in commandline MSBuild (for Code Analysis / FXCOP). The project file would have something like this in it:

<CodeAnalysisRules>-Microsoft.Globalization#CA1301;-Microsoft.Globalization#CA1302</CodeAnalysisRules>

So I would assume that I use something like this:

MSBuild.exe /property:RunCodeAnalysis=true /property:CodeAnalysisRules=-Microsoft.Globalization#CA1301

Which works fine, but when I want to add another rule, it does not like the semi colon:

MSBuild.exe /property:RunCodeAnalysis=true /property:CodeAnalysisRules=-Microsoft.Globalization#CA1301;-Microsoft.Globalization#CA1302

MSBUILD : error MSB1006: Property is not valid. Switch: -Microsoft.Globalization#CA1302

How can I specify more than one rule?

I am happy to reference a file, but I don't want to just change the project files.

Backgroud: I want to create a set of rules for a continuous integration server (Hudson in my case).

Note: I am running Visual Studio 2005

like image 260
Triple Point Avatar asked Nov 15 '22 14:11

Triple Point


1 Answers

Try this:

msbuild /property:RunCodeAnalysis=true;CodeAnalysisRules=-Microsoft.Globalizati
on#CA1301%3B-Microsoft.Globalization#CA1302
like image 112
KMoraz Avatar answered Dec 18 '22 04:12

KMoraz