Apr 6 2009

Automating x86 and x64 Builds.

Before attending the ALT.NET Houston Open Spaces Conference, I really didn’t know what to expect besides learning something. What did I want to learn? I had absolutely no idea. I just heard read good things about this event from many others at the Austin and Seattle ones. The sessions I went to were totally great and best of all, I bumped into a few familiar faces I totally didn’t expect to ever see again, hehe.

Now that I have been refreshed with a completely new eagerness to get caught up with the latest and greatest, I’m hoping to be able to contribute at the next ALT.NET conference. Ben, chop-chop, get on it! =)

Here is my main take away from the conference that I just finished.

Starting Point (x86 only): NAnt that kicks off MSBuild, runs tests, and copies to a package folder.

The problem I was running into is that I didn’t fully understand Visual Studio 2008′s Configuration Manager and how to integrate/mimic it with NAnt. I had to set the target platforms x86/x64 and it automatically configured the output paths:

[folder] – [configuration]|[platform]
  • bin/Debug – Debug|Any CPU
  • bin/Release – Release|Any CPU
  • bin/x86/Debug – Debug|x86
  • bin/x86/Release – Release|x86
  • bin/x64/Debug – Debug|x64
  • bin/x64/Release – Release|x64

Remember, these are defaults after you add solution configurations and solution platform. When you build, set the proper targets, F5 and you’re done. As for NAnt, I also had to target the proper configuration/platform:

/p:Configuration=${project.config} /p:Platform=${project.platform}

The tricky part here for me was to get NAnt to find the x64 Framework by parsing out the x86 path and do a string replace. Unfortunately, I’m using 0.85 and it seems to have a bug when trying to pass in a variable as the input string. Currently, I have to specify the directory, UGLY.

<property name=”msbuild-x86″ value=”${framework::get-framework-directory(framework::get-target-framework())}\msbuild.exe” />

<property name=”msbuild-x64″ value=”C:\Windows\Microsoft.NET\Framework64\v3.5\msbuild.exe” />

After reorganizing a few targets and adding more to specify x86 and x64 builds, it worked perfectly. The last step I did was to ensure the builds were targeting separate platform output folders.

Now, my next step is to automate the WiX build…