views:

585

answers:

3

I just learned about how to include FxCop on a build. But it's slow and I want it to be done just only on release builds. Is there any way to configure that?

+2  A: 

Haven't tested this but I think it should be something along the lines of:

<Target Name="MyTarget" Condition="'$(FlavorToBuild)'=='Release'">
   ...do release specific stuff...
</Target>
Gerrie Schenck
if you replace FlavorToBuild by Configuration, it works!
Jader Dias
A: 

Add a condition in the .msbuild script. Only execute the FxCop task if Configuration is "Release" not f.ex when it is "Debug"

ThorHalvor
+3  A: 

Check the configuration condition.

<Target Name="AfterBuild" Condition="'$(Configuration)' == 'Release' ">

  <FxCop TargetAssemblies="@(OutputAssemblies)"
       RuleLibraries="@(FxCopRuleAssemblies)" 
       DependencyDirectories="$(MSBuildCommunityTasksPath)"
       FailOnError="False"
       ApplyOutXsl="True"
       OutputXslFileName="C:\Program Files\Microsoft FxCop 1.32\Xml\FxCopReport.xsl"
       DirectOutputToConsole="true"/>
</Target>
madgnome