Thursday, August 19, 2010

Building a Silverlight application under CruiseControl.NET on a 64 bit platform

Yesterday a colleague of mine was trying to get his Silverlight 3 building on our continuous integration (CI) server and was getting an error, 'Silverlight 3 SDK is not installed', even though the SDK was installed on that machine.

It turns out that this is a common error when trying to compile a Silverlight app on a 64 bit platform. Unfortunately most of the solutions out there involved manually editing the appropriate Silverlight .target file to change paths to the SDK.

Another solution was to set the 'MSBuild Platform' to x86 under TFS 2010 ( This was a cleaner solution, but not much use to us as we use CruiseControl.NET rather than TFS.

In the end the solution was fairly simple. All we had to do was call the 32bit .NET 4.0 version of msbuild which resides in C:\Windows\Microsoft.NET\Framework\v4.0.30319 rather than the default 64 bit version.

We ended up removing the <msbuild> task from our nant build file, which was calling the 64 bit version, and replaced it with an <exec> task pointing to the appropriate version of msbuild.