VSTS 2005 – using TFS SDK to write code on my x64 box

I was trying to follow a source sample to obtain the VSTS project list, but got the following System.BadImageFormatException on the library file [ Microsoft.TeamFoundation.Client.dll ].

===== Exception =====

System.BadImageFormatException was unhandled
  Message=”Could not load file or assembly ‘Microsoft.TeamFoundation.Client, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. An attempt was made to load a program with an incorrect format.”
       at TfsApplication1.Program.Main(String[] args)
       at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()

===== More findings ===== 

It appears that the library cannot be used on my x64 box, and the workaround is to change the target platform of my project to [ x86 platform ].

–> Right-click on the project

  –> Properties

    –> Build

      –> Platform target: x86

===== For more information =====

~ MSDN: How to: use the TFS SDK to write code


~ MSDN forum: BadImageFormatException on Microsoft.TeamFoundation.Client.dll