TFS 2008 SDK will cause InvalidProgramException while running as 64 bit
Issue:
=====
You create a C# project that uses TFS 2008 SDK. But it crashes when you try to run it on a X64 bit OS machine:
Unhandled Exception: System.InvalidProgramException: Common Language Runtime detected an invalid program.
at Microsoft.TeamFoundation.Client.TeamFoundationServerFactory.GetServer(String name)
at TFSTestProject.Program.Main(String[] args)
This is the code that causes crash:
TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer("https://<server>:<port>",);
Root Cause:
==========
The TFS 2008 OM is not going to work correctly in a native 64-bit mode. For C# project, it’s default platform target is “Any CPU” (aka, X64 on a 64-bits OS).
Resolution:
=========
Go to Project Property of your C# project, click on Build tab, set “Platform Target” to x86, rebuilt. Now the program will run as a 32 bit executable and TFS OM work fine.
Comments
- Anonymous
April 19, 2008
PingBack from http://www.travel-hilarity.com/travel-airline-tickets/?p=201