CodeAnalysis, FxCop and Team Build
Team Build has a different interpretation for RunCodeAnalysis flag. The standard definition (interpreted by Visual Studio) treats it as boolean value that can be set to true or false. FxCop task will be executed with build only if this flag is set true.
Team Build implements RunCodeAnalysis as three ways flag. The allowed values of this flag are "Default"/"Always"/"Never". You can set this flag manually for your build type by editing TeamBuild.proj file. You can set the value of flag to either "Default" or "Never" using Team Build client. You have to manually edit TeamBuild.proj file to set the flag value to “Always”.
If you are building a solution (sln) containing three projects. The first project (csproj file) has RunCodeAnalysis flag set to true. The second project has RunCodeAnalysis flag set as false and the third project (csproj) does not define this flag at all.
- if ( RunCodeAnalysis = = “Default” )
Team Build will run FxCop based on individual project settings. In our example scenario, FxCop will be run for only for first project.
- if ( RunCodeAnalysis = = “Never” )
Team Build will override the individual project settings and FxCop will not run for any project.
- if ( RunCodeAnalysis = = “Always” )
Team Build will override the individual project settings and FxCop will run for all projects.
- if ( ( RunCodeAnalysis ! = “Always” ) AND ( RunCodeAnalysis ! = “Never” ))
Set RunCodeAnalysis = “Default"
Disclaimer: The information mentioned is for beta3 bits (releasing in September 2005).