Monday, December 22, 2008

FileNotFoundException: Could not load file or assembly 'Microsoft.TeamFoundation.Client....

At the start of my current project, I decided it was time to rewrite my TFS Build Utility against the 2008 API/SDK.

I didn’t get get very far before I started to see a “System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.TeamFoundation.Client, Version=” message whenever I ran my code.

More strange, the app would bring up my main form just fine, but as soon as it hit the constructor of my presenter, I’d get that error. The first line in my constructor was a call to a method where I’d be initializing my TeamFoundationServer object, but I never even got to that line, the exception happened as soon as I stepped into the first line of the constructor.

After a bit of Google searching, I eventually landed on Omar Villarreal's post on using the TFS API in a 64-bit environment – which is what I was doing, and the solution: setting the Platform Target property for my project to x86, instead of “Any CPU” as is set by default in Visual Studio.


  1. You saved my day with this post. I could not, for the life of me, figure out why I could run an app from my box, but not from a server (same code, located in a share). When I read this I realized the 3rd party assembly must be 32-bit.

  2. This is exactly what I was looking for! Tony thanks for saing my time :)

  3. Life Saver... I had referenced 2010 Beta binaries (which work fine under Any CPU) by accident and had to change to 2008, but couldn't figure out why it wouldn't work for the life of me.

  4. This worked for me as well. Thanks!

  5. Took me 4 hours and two reinstalls of VS SP1 until I found your post.
    Thank you very much!

  6. Really saved my day, have used this solution before, but was unable to really make to this solution in my case, but your post helped a lot