tags:

views:

212

answers:

2

Motivation: I have fxcop integrated in the build process, which makes fxcopcmd.exe run each time the target has changed or as long as there are warnings from the previous run of fxcop.

But when one works in the studio, devenv.exe often decides to compile the project in background for whatever reasons. For example, when I add a new project to the solution I notice that fxcopcmd.exe runs, meaning a background build has started. There are also other times as well.

So, I wish to suppress fxcop when built with devenv. Our CI server builds using msbuild, so no problem there.

BTW, if there is a way to disable the background builds, that could be great.

A: 

The only thing I can think of is to either

  1. create a different build type (such as debug_and_rules, release_and_rules, etc). I think ms build could read this.
  2. have your CI server call the fxcop exe separate from building the project. This is what I used to do before fxcop was integrated into VS.
  3. have msbuild set a setting or compiler flag that ms build could read. I'm not sure if this would work.

The background compiler was added in VS 2008 to C#, and as far as I know, is not configurable. VS 2010 is supposed to be ultra configurable so maybe that will change

Edit: formatted my list a little better

Jacob Adams
+1  A: 

There is a property BuildingInsideVisualStudio which will tell you this.

For example compare the result when using msbuild.exe and devenv.exe with a .csproj with the following AfterBuild target defined

<Target Name="AfterBuild">
  <Message Text="BuildingInsideVisualStudio: $(BuildingInsideVisualStudio)" Importance="high"/>
</Target>
Sayed Ibrahim Hashimi