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=126.96.36.199, 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 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
===== 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
–> Platform target: x86
===== For more information =====
~ MSDN: How to: use the TFS SDK to write code
~ MSDN forum: BadImageFormatException on Microsoft.TeamFoundation.Client.dll