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=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. An attempt was made to load a program with an incorrect format.”
StackTrace:
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
http://msdn2.microsoft.com/en-us/library/bb286958(VS.80).aspx
~ MSDN forum: BadImageFormatException on Microsoft.TeamFoundation.Client.dll
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=760600&SiteID=1
jqHXrv