How to get NHProf reports in TeamCity running MSBUILD

Posted by Jon Erickson on Stack Overflow See other posts from Stack Overflow or by Jon Erickson
Published on 2010-05-13T01:24:02Z Indexed on 2010/05/13 1:34 UTC
Read the original article Hit count: 418

I'm trying to get NHProf reports on my integration tests as a report in TeamCity

I'm not sure how to get this set up correctly and my first attempts are unsuccessful.

Let me know if there is any more information that would be helpful...

I'm getting the following error, when trying to generate html reports with MSBUILD (which is being run by TeamCity)

error MSB3073: The command "C:\CI\Tools\NHProf\NHProf.exe /CmdLineMode /File:"E:\CI\BuildServer\RMS-Winform\Group\dev\NHProfOutput.html" /ReportFormat:Html" exited with code -532459699

I tell TeamCity to run MSBUILD w/ CIBuildWithNHProf target

The command line parameters that I pass from TeamCity are...

/property:NHProfExecutable=%system.NHProfExecutable%;NHProfFile=%system.teamcity.build.checkoutDir%\NHProfOutput.html;NHProfReportFormat=Html

The portion of my MSBUILD script that runs my tests is as follows...

<UsingTask TaskName="NUnitTeamCity" AssemblyFile="$(teamcity_dotnet_nunitlauncher_msbuild_task)"/>

<!-- Set Properties -->
<PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <NHProfExecutable></NHProfExecutable>
    <NHProfFile></NHProfFile>
    <NHProfReportFormat></NHProfReportFormat>
</PropertyGroup>

<!-- Test Database -->
<Target Name="DeployDatabase">
    <!-- ... -->
</Target>

<!-- Database Used For Integration Tests -->
<Target Name="DeployTestDatabase">
    <!-- ... -->
</Target>

<!-- Build All Projects -->
<Target Name="BuildProjects">
    <MSBuild Projects="..\MySolutionFile.sln" Targets="Build"/>
</Target>

<!-- Stop NHProf -->
<Target Name="NHProfStop">
    <Exec Command="$(NHProfExecutable) /Shutdown" />
</Target>

<!-- Run Unit/Integration Tests -->
<Target Name="RunTests">
    <CreateItem Include="..\**\bin\debug\*Tests.dll">
        <Output TaskParameter="Include" ItemName="TestAssemblies" />
    </CreateItem>
    <NUnitTeamCity Assemblies="@(TestAssemblies)" NUnitVersion="NUnit-2.5.3"/>
</Target>

<!-- Start NHProf -->
<Target Name="NHProfStart">
    <Exec Command="$(NHProfExecutable) /CmdLineMode /File:&quot;$(NHProfFile)&quot; /ReportFormat:$(NHProfReportFormat)" />
</Target>

<Target Name="CIBuildWithNHProf" DependsOnTargets="BuildProjects;DeployTestDatabase;NHProfStart;RunTests;NHProfStop;DeployDatabase">
</Target>

© Stack Overflow or respective owner

Related posts about nhprof

Related posts about msbuild