Share via


Building Windows Phone apps with a 64-bit Build Agent from TFS build

Developers writing Windows Phone 7 or 7.1 apps who use TFS to manage their builds can find that setting up machines to be build agents is a time consuming and problematic process.  You have to make sure all the patches and updates for the OS are installed.  All of the service packs and security updates are intalled for your development environment.  The Windows Phone SDK needs installed as well as any third party tools you may use in your application.  When you finally complete this process and you kick off a build, you might see an error like this:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.Phone.Controls.Toolkit, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b772ad94eb9ca604, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

This isn't what you expected!  You know you just installed the Windows Phone SDK (on a 64-bit Server OS no less), how can it not be found!?!?

The key is here:  C:\Windows\Microsoft.NET\Framework64

By default the MSBuild process is launched to match the bitness of the host operating system.  Unfortunately, many Windows Phone apps target the platform using Silverlight for Windows Phone and this as well as versions of Silverlight up through 4 are only supported on 32-bit platforms.  64-bit support is coming in SilverLight 5

So how do you tell TFS to run the 32-bit version of MSBuild?  The answer is in your build definition for your Windows Phone project.  When you edit your build definition in VS 2010, select Process and go into the Advanced Settings option and change the MSBuild Platform drop down list from Auto to x86.

 

Now when you schedule a build, the 32-bit version of MSBuild will be used and all of those 32-bit tools will produce your Windows Phone applications without a problem!

Comments

  • Anonymous
    December 22, 2013
    Thanks for this post! Saved me hours! :-)

  • Anonymous
    August 12, 2014
    thx