Sunday, August 8, 2010

Building Silverlight applications on a 64bit build server

If you created a Silverlight project and tried to build on a 64bit build server, you might face one of the following errors:

The "ValidateXaml" task failed unexpectedly.
System.BadImageFormatException: Could not load file or assembly 'obj\x64\Debug\SilverlightApplication1.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.

or if you are building using 64-bit MSBuild:

"SilverlightApplication1.csproj" (GetXapOutputFile target) (2:2) ->
  C:\Program Files (x86)\MSBuild\Microsoft\Silverlight\v3.0\Microsoft.Silverlight.Common.targets(101,9): error : The Silverlight 3 SDK is not installed. [SilverlightApplication1.csproj]

As Silverlight DOES NOT support x64 platforms, you always have to build it as x86 process. Configuring this is Team Build is easy. Open up your build definition and explicitly select x86 for the MSBuild platform setting. That’s all!

No comments: