Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you turn off conditional compilation symbols from msbuild.exe command line?

We have CODE_ANALYSIS defined in our C# components so that FxCop analyzes them when we build them on our development boxes. I would like to have FxCop turned off when it runs through our build system. The build system is obviously using the msbuild.exe command line command. Is there a way to modify the conditional compilation symbols from this executable? If not, does anyone know any other possible solutions to my problem (other than turning it off manually)?

Thanks.

like image 747
blachniet Avatar asked Jul 11 '11 13:07

blachniet


1 Answers

The CODE_ANALYSIS compilation symbol controls whether the SuppressMessageAttribute instances included in the code are copied into the compiled assembly. It does not control whether FxCop runs. If you want to override a project-level MSBuild property like RunCodeAnalysis (which is the beastie that controls whether FxCop runs under MSBuild), you should be able to use the MSBuild.exe /property command line switch. e.g.:

msbuild.exe <...> /property:RunCodeAnalysis=true
like image 64
Nicole Calinoiu Avatar answered Sep 21 '22 06:09

Nicole Calinoiu