64-Bit Team Build Fails on Silverlight Projects (and How to Fix It)

If you have a Silverlight project under source control, and try to build it on a 64-bit Team Build (or similar) server, you may encounter the following error:

Error: The Silverlight 3 SDK is not installed.

After checking the immediately obvious (i.e. is the SDK installed), you might wonder why this is happening.  It has to do with the build running under 64-bit MSBuild.  The Silverlight build tasks determine which versions of the framework are installed by reading from the registry.  This key in 32-bit Windows is under HKLM\Software\Microsoft\….  On a 64-bit system, however, it’s under HKLM\Software\Wow6432Node\ Microsoft\…, and the build tasks fail to find the values they’re looking for.

To work around this issue, you need to set your project to build under the x86 toolset.  To do that in TFS, you need to edit your build configuration to build for the x86 platform:

Editing the build configuration

We do not have a fix for this at this time, but we are tracking the issue for an upcoming release.