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?
Asked
Active
Viewed 1.6k times
3 Answers
82
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>

Julien Hoarau
- 48,964
- 20
- 128
- 117
4
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
- 22,148
- 20
- 68
- 95
0
Add a condition in the .msbuild script. Only execute the FxCop task if Configuration is "Release" not f.ex when it is "Debug"

ThorHalvor
- 628
- 5
- 17