Side note: I really miss my “, or How to…” blog post titles.

The title should have narrowed down the focus for you already. I’ve been bear wrestling with some OSS projects on Team City for a few weeks now. It seems NAnt has some issues with a brand new Windows Server 2008 (64-bit) with .NET 3.5 SP1 (and possibly the .NET SDK). Specifically, it doesn’t recognize that .NET 3.5 is installed and will try to use .NET 2.0 by default.

I say “seems” because this is all working theory. For almost every project I looked at that used NAnt, I had to configure it to use –t:net-3.5 in the command line parameters to force it to use .NET 3.5. And even then, I still ran into a pretty nasty issue with one of the projects.

The error was something along the lines of “Microsoft .NET 3.5 is not installed, or not correctly configured.” After several installs/re-installs of various frameworks and SDKs, I finally broke out the NAnt source code and traced it to the installRoot and sdkInstallRoot properties from NAnt.exe.config.

I’ll cut this off by saying a link is worth a thousand words. The two aforementioned properties pointed to the HKLMSOFTWAREMicrosoftMicrosoft SDKsWindowsv6.0a but the key in the server was HKLMSOFTWAREMicrosoftMicrosoft SDKsWindowsv6.1. As suggested in the article, I faked it out by manually adding the keys it was looking for with values I deemed appropriate…

…and it *still* didn’t work. “Lord Tunderin’ Jayzus,” says I and because I was sufficiently peeved, I added “and Moses on a boat!”

Try as I might, I could not get NAnt to read the registry key. I cussed out deities in all major religious (except Buddhism; eternal damnation I can deal with, karma kinda scares me) until I discovered a link worth TWO thousand words. Somewhere in the depths of 64-bit land, Windows is picking up requests to HKLMSOFTWAREMicrosoftMicrosoft SDKsWindowsv6.1 and redirecting them to HKLMSOFTWAREWow6432NodeMicrosoftMicrosoft SDKsWindowsv6.1. So I duplicated the appropriate key once again and I’m shiny and happy and able to sleep once more.

Note that this is expected to be fixed in some upcoming release of NAnt (and very well may be addressed already). But each of the projects on the server uses NAnt in a different way, some including it in their code repository itself, and I am not in the position to upgrade NAnt in any of them.

Special shut-out to Tim Barcz for the link that, while worth only about 850 words tops, got me on the right track nonetheless.

Kyle the Karmic