Welcome to MSDN Blogs Sign in | Join | Help

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”.

 

Example scenario 

 

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). 

Published Thursday, July 14, 2005 9:10 PM by ManishAgarwal

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# HowTo: Disable specific Code Analysis rules for a Team Build

Thanks to the MSDN forums (and specifically one Hua Chen), I found a way to disable specific code analysis

Monday, September 24, 2007 9:47 AM by Gump's blog

# Including Fxcop rules stored in Xml File in Tfs build.

How to Include custum Fxcop rules stored in XML file in TFSbuild script .

Wednesday, January 30, 2008 9:50 AM by Ben

# re: CodeAnalysis, FxCop and Team Build

Hi ,

I have an Xml file which conatins certain rules for including in build.

For Eg

<FxCopRules>

<Include category="Errors">

   <Rule>Microsoft.Design#CA1012</Rule>

   <Rule>Microsoft.Design#CA1040</Rule>

   <Rule>Microsoft.Design#CA1011</Rule>

   <Rule>Microsoft.Design#CA1009</Rule>

   <Rule>Microsoft.Design#CA1050</Rule>

</Include>

</FxCopRules>

How to make sure this can be incorporated in TFS build.Such that this rule will apply to all projects

Thursday, February 07, 2008 8:42 AM by Justin

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker