Fixing NAnt 0.86 Beta 1 for .NET 3.5 Continuous Integration

This post was written by dpx on January 4, 2009
Posted Under: .NET, Programming

I recently had a little problem with my build scripts on my CI server. Since I have Visual Studio 2008 installed on my development machine, NAnt finds the Windows SDK v6.0A installed (flack from the VS2k8 install) and runs along happily building .NET 3.5 libraries (where I use WCF for SOA layers). However, when I recently created a new build server without installing Visual Studio, I kept getting these errors about the sdkInstallRoot not being found for net-3.5. I went ahead and downloaded and installed the latest Windows SDK for Vista (v6.1), but it had no effect on the build scripts.

I started digging into the blogosphere and found an article by Tim Barcz describing how to fix NAnt for .NET 3.5. This lead me to doing a little poking around in the NAnt.exe.config file, and I found the following registry key search:

<readregistry
property=”sdkInstallRoot”
key=”SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.0A\WinSDKNetFxTools\InstallationFolder”
hive=”LocalMachine”
failonerror=”false” />

The funny thing about that registry key is that it exists when you install Visual Studio, but not when you install the latest SDK. I did not want to alter the config file because on developer machines in a large team, you’re more likely to see Visual Studio installed than not. The above registry key is found then, and everything works. But for a build server where the basics are installed (CruiseControl.NET, Subversion, and the Windows SDK v6.1), this doesn’twork out so well.

What I ended up doing was creating a registry key on the build server that mimiced the above key, but actually pointed to the 6.1 SDK. Once NAnt can find the installed SDK path, it actually links to the proper libraries (usually found in C:\Windows\Micrsoft.NET\Framework\v3.5 and v3.0 respectively). This keeps the NAnt config file the same, thus sparing developers from having to modify their registry, and fixes the build server so it can compile against .NET 3.0 and 3.5 libraries.

Add a Comment

You must be logged in to post a comment.