Galin Iliev's blog

Software Architecture & Development

TFS 2010 Basic: Server build of Windows Phone 7 project

I just started taking advantage of TFS 2010 Basic (or TFS 2010 for SourceSafe users as Brian Harry named it Smile) and found something interesting to share. The project I was testing with is Windows Phone 7 one and it was building perfectly form VS 2010. But when triggered a server build the agent fails with following error:

C:\Program Files (x86)\MSBuild\Microsoft\Silverlight for Phone\v4.0\Microsoft.Silverlight.Common.targets (185): The "CompileXaml" task failed unexpectedly. System.IO.FileLoadException: Could not load file or assembly 'PresentationCore, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047) File name: 'PresentationCore, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35'  Server stack trace:     at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)    at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)    at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)    at System.Reflection.Assembly.Load(String assemblyString)    at Microsoft.Silverlight.Build.Tasks.CompileXaml.LoadSilverlightAssemblies(String[] frameworkPaths)    at Microsoft.Silverlight.Build.Tasks.CompileXaml.GenerateCode(ITaskItem item, Boolean isApplication)    at Microsoft.Silverlight.Build.Tasks.CompileXaml.Execute()    at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)    at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)  Exception rethrown at [0]:     at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)    at Microsoft.Build.Framework.ITask.Execute()    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult) 

As the name of TFS 2010 Basic suggests I have everything on same machine – VS 2010, TFS server, build controller, build agent… and it still failed.

The solution is in Build definitions: set MSBuild platform to X86:


Seems like Windows Phone 7 projects need to be build using x86 as a target platform only…

Hope this helps

Comments (1) -

  • Darren

    3/20/2011 2:26:40 AM | Reply

    Thanks very much Galin.  I had exactly the same problem and your solution worked for me! Smile