views:

447

answers:

2

I'm having trouble getting Code Analysis to run on the build server. My goal is that on checkin the build server will build and run code analysis automatically. For some rules I would like the build to fail. I know how to use the team explorer to set which rules cause a fail.

I don't want the developer to have to run code analysis to checkin. I want the build server to take care of all of it.

The build succeeds, however, code analysis is not run.

I used this to set it up, however when I do a search on the log I don't find anything to do with code analysis. When I run code analysis locally there are hundreds of warnings, but the build shows like 32 warnings.

Any ideas? Do I need to install anything specific on the build server to enable/allow code analysis? The build server does not have visual studio, it does not have the team explorer. It serves a dual purpose as our test web server and build server and I want to install only the bare essentials.

+1  A: 

Check your TFS build configuration. There's actually an option in there to globally turn of code analysis.

Inside my project's "TFSBuild.proj" file, I have this line along with comments:

    <!--  CODE ANALYSIS
 Set this property to enable/disable running code analysis. Valid values for this property are 
 Default, Always and Never.

     Default - Perform code analysis as per the individual project settings
     Always  - Always perform code analysis irrespective of project settings
     Never   - Never perform code analysis irrespective of project settings
 -->
<RunCodeAnalysis>Default</RunCodeAnalysis>

Do you have anything similar that you can set or alter?

We have ours set to "Default", but yours may have a different (Never) default.

Jeff Wilcox
Ours is set to always. Thanks for the suggestion though.
Josh
+1  A: 

Be sure that the edition of Visual Studio installed on the build server provides Code Analysis.

Aidan Ryan
I installed the development sdk (required) on the build server, but not VS. So code analysis will not run without Visual Studio?
Josh
http://msdn.microsoft.com/en-us/library/ms181712.aspx Aha! FTA: "To run tests during a build, Test Edition must be installed on the build computer. In order to run unit testing, code coverage, or code analysis, Visual Studio Team System Development Edition must be installed on the build computer." Thanks Aidan.
Josh