Build Silverlight 2.0 or 3.0 projects with an x64 TFS 2010 Build Agent

I was trying to build our biggest solution after migration (TEST migration) and found that Silverlight projects won't compile. The first error we received was "The Silverlight 2 SDK is not installed". I found a post on the Silverlight forum about this and managed to fix the error, but then a second error appear:

 "The "ValidateXaml" task failed unexpectedly ... System.IO.FileLoadException: Could not load file or assembly 'PresentationCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)

According to the people in the Silverlight forum, this is a Silverlight BUG and it won't compile in an x64 environment, so the general workaround is to use an x86 Build Agent.

Fortunately, I found a MUCH BETTER workaround for TFS 2010, wich only involves changing the configuration of the build definition and set the "MSBuild Patform" to "X86" (it was "Auto" before).

After this, my Silverlight projects compile again, even in an x64 Build agent. Nice!

Just for reference, the Silverlight post is here:  http://forums.silverlight.net/forums/p/113956/256849.aspx

Andres G Vettori, VMBC, CTO

No Comments