NAnt on Windows Server 2008 64-bit with .NET 3.5

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 HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.0a but the key in the server was HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.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 HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.1 and redirecting them to HKLM\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v6.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

This entry was posted in Continuous Integration, NAnt. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • Chris

    I’m getting the following x64 issue with NAnt. How did you overcome it?

    (NAnt build 0.85.2478.0 10/14/2006)

    [sysinfo] Setting system information properties under sys.*


    Property name ‘sys.env.CommonProgramFiles(x86)’ is invalid.

  • Chris

    I’m having the following issue under x64. How did you or how can I get around this x64 issue.

    [sysinfo] Setting system information properties under sys.*


    Property name ‘sys.env.CommonProgramFiles(x86)’ is invalid.

  • mendicant

    And for the record, accidentally (really!!) deleting WOW6432Node is a really, really bad idea.

    Trust me.

  • mattcalla

    @Kyle Baley: well I reckon the ‘How to’ titles should make a comeback tour – if people don’t like those titles, they can go find something else to read and something else to complain about. Theres always room for an alternative view on something and a bit of humour – which is one of the great things about your posts.

  • Kyle Baley

    @mattcalla: I was accused of being tacky (see the link that acoompanied my lamentation). And while normally, I relish the compliment, this time I was sensitive to the views of one of my listeners and stopped the practice.

  • mattcalla

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

    Why did you stop doing the ‘How to’ titles? I always thought they were quite interesting.

  • Martin

    Fooled me as well at one time.

    I was aware of the problem and knew that my 32-bit program would read some settings from the WOW hive.

    The mistake I did was that I assumed that regedit would treat REGEDIT4 files as 32bit entries and put them in the WOW hive as well.