Geeks With Blogs
Clara's Notes on Technology Notes to me and the world

For the last few months I have been helping a client adopt Team System - Team Foundation Server. Since these tools are quite new, I will try to keep a log of what I have done.

Builds: From MSBuild to TFSBuild

The starting situation is an MSBuild script customized for a given team's needs. The default target can execute the following procedure:

  1. Delete network share
  2. Backup latest build
  3. Clean
  4. Get latest from source control
  5. Increase version and add label in source control if building in Release mode
  6. Build
  7. Run NUnit tests
  8. Run FxCop analysis
  9. Run WiX (create msi)
  10. Run NDoc (generate documentation)
  11. Create network share
  12. Drop build output in network share

This script was used both as enterprise build and as developer build by setting different property values. For example, when being run by a developer it would not run the test or the static analysis and it would not increase the version number or set a label in source control.

My proposal consists in the following creating a build type that peforms all the tasks above. Points 1-6 and 11-12 are alreayd done by default by tfsbuild. The network share is in the build drop location, sources are obtained from TFS and copied locally to the build server, a label with the build name is applied automatically, etc. Admittedly, you might want to customize the build number but I will talk about this later.

As for the other points, this is what I suggested:

7- Ideally, move to TS tests and forget about NUnit. In the meanterm, I created a "NUnit" target that runs the test (in fact, I could basically copy/paste the target from the original script).

8- FxCop target is no longer needed since static analysis is integrated in team system and thus in build types (you can indicate it in the build type wizard). For the enterprise build I would set static analysis to "always".

9- I integrated it as a new target in TFSBuild.proj (could be reused almost "as is").

10- Same as 9. Create a specific target for it.

So now I have created 3 new targets in TFSBuild.proj: NUnit, WiX, NDoc. Since I want to run them after compilining I defined them as dependencies of the "AfterCompile" target, like this:


<target name="AfterCompile" dependsontargets="NUnit;WiX;NDoc">
<message text="AfterCompile target executed."> </message>
</target>

I have also set a condition on each of the new targets, so that they can be turned on/off at will:

<RunUnitTests>false</RunUnitTests>
...
<Target Name="NUnit" Condition="'$(RunUnitTests)'=='true'">
...
</Target>

My current problem is that I would like to turn on/off these options without having to change the TFSBuild.proj. This way we would have a script (TFSBuild.proj) with all the default values for the options that could be run from the team explorer. If we want to run the tf build with other options, I would like to be able to do it with the command line (tfsbuild.exe tool). But that does not seem to be possible.

It is possible to override the options values if you execute the TFSBuild.proj script from MSBuild.exe, but then you lose the advantages of TF builds (build server, drop locations, automatic get and label, etc.). In fact I am using MSBuild.exe to run TFSBuild.proj for developer builds as described here.

Posted on Friday, November 17, 2006 7:57 PM Team System | Back to top


Comments on this post: From MSBuild to TFSBuild

# re: From MSBuild to TFSBuild
Requesting Gravatar...
Folks interested in FxCop should have a glance at the tool NDepend:
http://www.NDepend.com

NDepend analyses source code and .NET assemblies. It allows controlling the complexity, the internal dependencies and the quality of .NET code.

NDepend provides a language (CQL Code Query Language) dedicated to query and constraint a codebase.

It also comes from with advanced code visualization (Dependencies Matrix, Metric treemap, Box and Arrows graph...), more than 60 metrics, facilities to generate reports and to be integrated with mainstream build technologies and development tools.

NDepend also allows to compare precisely different versions of your codebase.

Finally, NDepend comes with facilities for MSBuild and NAnt integration.

Left by Patrick Smacchia on May 03, 2007 6:33 AM

Your comment:
 (will show your gravatar)


Copyright © Clara Oscura | Powered by: GeeksWithBlogs.net