Thursday, June 26, 2008

NAnt and MSBuild 3.5

Today I have just upgraded TeamCity Visual Studio plugin sources to use new VS 2008. So I had an issue updating my NAnt script to support MSBuild 3.5. We use task from NAnt contrib project.

As you may know, TeamCity NAnt runner replaces standard msbuild task with it's own
one. This is done specially to provide better logging for MSBuild process.

To switch to MSBuild 3.5 one can do one of the following tricks:
- set target framework to net-3.5 (if it is NAnt 0.86 beta 1);
- define property 'teamcity_dotnet_use_msbuild_v35' in the msbuild task and set it to 'true'. This will work only when run under TeamCity.


So I have selected the second approach. So my NAnt script now looks like:

<msbuild project="${base}\addin\addin.sln" target="Rebuild">
<property name="Configuration" value="${config}" />
<property name="RegisterOutputPackage" value="false" />
<!-- Switch on msbuild 3.5 for msbuild task -->
<property name="teamcity_dotnet_use_msbuild_v35" value="true" />
</msbuild>


I tried that as a pre-tested commit from Visual Studio 2008, it passed, and was auto-committed into TFS.

No comments: