Jobping Laurent Kempé MVP JetBrains Academy Member Certified ScrumMaster


My status

View Laurent Kempé's profile on LinkedIn

Xbox 360


Locations of visitors to this page

.NET Dudes


French .NET Dudes




Tech Head Brothers

April 2008 - Posts

Run NCover through MSBuild in Team City

After one comment of Chris Walquist on one of my last post about Team City integration of NCover here is the way I run NCover through MSBuild in Team City.

First I need to import the Task of NCover.

TaskName="NCoverExplorer.MSBuildTasks.NCover"AssemblyFile="$(NCoverPath)\Build Task Plugins\NCoverExplorer.MSBuildTasks.dll" />
TaskName="NCoverExplorer.MSBuildTasks.NCoverExplorer"AssemblyFile="$(NCoverPath)\Build Task Plugins\NCoverExplorer.MSBuildTasks.dll" />

Then I define some properties:

    <!-- NCover -->
    <NCoverPath>C:\Program Files\NCover</NCoverPath>
    <NUnitPath>C:\Program Files\NUnit 2.4.6\bin</NUnitPath>
    <TestDll>TechHeadBrothers.Portal.DataAccess.Tests.dll TechHeadBrothers.Portal.DataAccess.dll</TestDll>

Then I have two targets:

  <Target Name="FullCoverage">
    <Message Text="#--------- Executing NCover ---------#" />
    <NCover ToolPath="$(NCoverPath)" 
            AssemblyList="$(CoverageAssemblies)" />
    <!-- Summary Page -->
    <NCoverExplorer ToolPath="$(NCoverPath)" 
                    HtmlReportName="CoverageSummary.html" />
    <!-- Full HTML Report -->
    <NCoverExplorer ToolPath="$(NCoverPath)" 
                    HtmlReportName="Coverage.html" />

And finally in the target AfterBuild (more on that in this post) I call target SummaryCoverage or FullCoverage according to the configuration:

  <Target Name="AfterBuild">
    <CallTarget Condition=" '$(Configuration)' == 'Staging' " Targets="SummaryCoverage" ContinueOnError="false" />
    <CallTarget Condition=" '$(Configuration)' == 'Nightly' " Targets="FullCoverage" ContinueOnError="false" />

That's it!

Then Chris asked the following:

1) How did you get your "tests" tab to show up as well?  Did you have to run the tests with NUnitLauncher, and then run again for coverage?  I read that NUnitLauncher can't be used to profile, since it kicks off a separate process.

2) How did you get the "classes", "header", "index", etc. files?  I just get the summary.html.  I see options for this in ncover.console.exe but not in the <NCoverExplorer> target.

3) Did you use wildcard expressions to pass a list of test assemblies to NCover?  If so, would like to see how you did that, too.

1) I get the test tab configuring Team City to run my unit tests. That has nothing to do with NCover. And yes doing it so seems to run two time all unit tests. Here is a screen shot of my team city runner configuration:

2) Read this post "Using NDepend in Team City build management tool" that talks about for NDepend but shows configuration for NCover too.

3) The answer is on top of this post!

Hope it helps!

Using NDepend in Team City build management tool

In my effort to bring a good development environment for the next version of Tech Head Brothers portal, in which we should be (at the moment) three to develop, I went on with the integration of NDepend, the wonderful tool of Patrick Smacchia, with the just as well JetBrains Team City build management server.

As said in my last post I have defined three builds type

  1. Continuous Integration - running compilation, unit testing, code coverage and deployment on staging
  2. Nightly build - to find duplicates in the code
  3. Nightly build - running compilation, unit testing, code coverage and code analyze

NDepend is integrated in the 3rd point during this nightly build for the code analyze.

My solution in Visual Studio is organized as the following:

In which you can see

  1. a Visual Studio 2008 Web Deployment Projects which I customized to carry out the different build tasks for the 3 different built types (Continuous Integration, Nightly duplicates and Nightly full analyze): TechHeadBrothers.Portal.csproj_deploy, this is just a MSBuild script
  2. The configuration file for NDepend: TechHeadBrothers.Portal.xml

The next thing I used is to define new configuration:

Nightly and Staging configuration are new one based on the Debug configuration. This will help me to control my MSBuild script with the two build types I am interested about: Continuous Integration = Staging, Nightly = Nightly (obvious ;).

Let's take a look at the MSBuild script with the new "Open Project File" menu in Visual Studio 2008:

First I am importing the MSBuild tasks exposed by NDepend like this:

  <UsingTask AssemblyFile="$(NDependPath)\MSBuild\NDepend.Build.MSBuild.dll" TaskName="NDependTask" />

Then defining some properties that will ease the build script writting later on:

    <!-- NDepend -->
    <NDependPath>C:\Program Files\_Tools\Development\ndepend</NDependPath>

Then I define a Target for NDepend:

  <Target Name="NDepend">
    <Message Text="#--------- Executing NDepend ---------#" />
    <NDependTask NDependConsoleExePath="$(NDependPath)" 
                 OutDir="$(NDpendOutputDir)" />

Then in the after build target I call the NDepend target if the configuration is the Nightly one:

  <Target Name="AfterBuild">
    <CallTarget Condition=" '$(Configuration)' == 'Staging' " Targets="SummaryCoverage" ContinueOnError="false" />
    <CallTarget Condition=" '$(Configuration)' == 'Nightly' " Targets="FullCoverage" ContinueOnError="false" />
    <CallTarget Condition=" '$(Configuration)' == 'Nightly' " 
                ContinueOnError="false" />

Now what we want to have is the possibility to see the report generated by NDepend on the Team City portal like this:

To achieve this like for NCover (Integration of NCover into Team City for Tech Head Brothers) we have to configure Team City to deal with the artifacts that NDepend creates, so in the settings of your build you need to define the following:


Then you need to edit on the build server the file main-config.xml and add the following configuration:

<report-tab title="Code Coverage Summary" basePath="" startPage="CoverageSummary.html" />
<report-tab title="Code Coverage" basePath="Coverage" startPage="index.html" />
<report-tab title="NDepend" basePath="NDepend" startPage="NDependReport.html" />

Beware not to have two title with the same value!

You will get access also to all created artifacts through the artifacts tab of Team City:

Remark: It would be really nice to be able to have a RSS Feed that would expose the artifacts created! I hope to see this feature in a next release of Team City!

Happy build management!

10 to -1, First negative score at Innoveo Solutions :-)
10 to -1 in BabyFoot at innoveo

Bojan and Me made it! Hey Lorenz and Andrea next time you will do better.

Thanks to Vista Roll Back Driver

Since the last update two-three days ago of my notebook ATI video drivers I had only crashes! Finally thanks to the Vista Roll Back Driver I was able to go back to the previous version and I don't have anymore crashes when I go in sleep mode.

It would be time that we get something more stable from the gfx card manufacturers!

Posted: Apr 23 2008, 10:59 PM by lkempe | with 3 comment(s)
Filed under:
Continuous integration and Nightly build with Team City

I finally found some time this evening to re-configure Team City and adapt my MSBuild script to be able to achieve the following build configuration for Tech Head Brothers portal:

  • CI Trunk - Unit Tests, Coverage, Deploy Staging
    • Checkout source code from subversion Portal project trunk
    • Compile
    • Run NUnit tests
    • Run NCover with summary code coverage report
    • Deploy to the Staging IIS
  • Nightly Trunk - Duplicate Finder
    • Find duplicates using Team City Build Runner
  • Nightly Trunk - Unit Tests, Coverage, NDepend
    • Checkout source code from subversion Portal project trunk
    • Compile
    • Run NUnit tests
    • Run NCover with summary code coverage report
    • Run NCover with full code coverage report
    • Run NDepend

Asap I will post about the way I achieve this configuration!

VisualSVN 1.4 released

VisualSVN, the plugin for Subversion in Visual Studio 2003, 2005 & 2008 was just updated with some new good features:

New Features
  • Quick Diff

    Quick Diff 
    Reviewing changes has never been so easy. Now you don't have to open separate diff window and remember locations of edited code blocks. VisualSVN marks in real-time the text lines changed since original version of the file and offers convenient navigation between them.
    Instead of pressing Page Up/Page Down several times and looking for changes just press Ctrl+Shift+Up/Down and jump to the next change immediatelly.

  • Toolbar

    You don't need to remember curent code branch you are working on. There is current repository URL displayed on the VisualSVN toolbar and you can easily switch to another code branch from there. Buttons for the most common Subversion commands also make the life a bit easier.

  • Add Solution Wizard
    Add Solution

    First steps in using VisualSVN might have been non-trivial if you are not a Subversion expert. But with the brand new "Add Solution to Subversion" wizard it's just a piece of cake. The wizard automatically detects all potential problems and makes everything simple and intuitive.

  • Improvements and Bugfixes

    This release contains many stability fixes and improvements (eg. command-line tools included by default, digitally signed istallation package and more). For full list of changes please read VisualSVN changelog.

Upgrading from VisualSVN 1.3.x

The upgrade to VisualSVN 1.4 is free for all licensed users of VisualSVN. No need to uninstall previous version - simple install new one on top of it.


Follow to the download page to get VisualSVN 1.4 and enjoy new level of productivity!

Posted: Apr 21 2008, 10:57 PM by lkempe | with 2 comment(s)
Filed under: ,
Finally the new CTP April of the Open XML Format SDK is online

This is something I was waiting to continue my work on the new publishing tool for Tech Head Brothers.

You might read more about this version on the MSDN web page

This SDK is built on top of the System.IO.Packaging API and provides strongly-typed part classes to manipulate Open XML documents.

You can download this CTP on the following page.

Posted: Apr 18 2008, 12:19 AM by lkempe | with no comments
Filed under:
Team City 3.1 and NDepend 2.8 integration

I finally managed to integrate those two wonderful tools Team City and NDepend as you can see on the following picture:

I will post soon the way I use to integrate those two, as I did for NCover.

Get back almost 1GB of free disk space after Vista SP1 installation

If you have installed SP1 of Vista you certainly recognized that your drive lost around 1Gb of free space.

The solution is to use a tool that comes with the SP1 to recover your free space at the price of not being able to come back and uninstall the SP1.

This tool is vsp1cln.exe that you can run like this:

Posted: Apr 06 2008, 12:32 PM by lkempe | with 8 comment(s) |
Filed under:
MSBuildProjectDirectory issue in Web Deployment Project! Any idea Welcomed!

I go crazy with a stupid error!

I try to have my web deployment project use the property MSBuildProjectDirectory like this:

  <Target Name="NDepend">
    <Message Text="#--------- Executing NDepend ---------#" Importance="normal"/>
    <Message Text="NDepend ProjectFilePath: $(NDependProjectFilePath)" Importance="normal"/>
    <Message Text="NDepend OutDir: $(NDpendOutputDir)" Importance="normal"/>
    <NDependTask NDependConsoleExePath="$(NDependPath)"
           OutDir="$(MSBuildProjectDirectory)..\..\Tests\Output\NDependOut" />

And with Visual Studio 2008 I have the following error:

Error    1    The NDepend project file T:\_Projects\_handsup\Portal_HandsUP\Deployment\TechHeadBrothers.Portal.csproj_deploy..\..\Tests\NDepend\TechHeadBrothers.Portal.xml can't be found.   

So I am getting the correct folder but the filename of the project file too. Weird.

In the documentation there are saying that


The absolute path of the directory where the project file is located, for example, C:\MyCompany\MyProduct.

By I am getting


The absolute path and complete file name of the project file, for example, C:\MyCompany\MyProduct\MyApp.proj

Any idea would be greatly appreciated!

Update: In fact I mixed two things folder and files. TechHeadBrothers.Portal.csproj_deploy is a folder and I thought it was a file :-( too bad

Now the second issue is that there is a bug in NDepend MSBuild task that I communicated to Patrick (the author) and he fixed and I could test it. It will be released next week. I will post about my integration of NDepend with Team City soon.

More Posts