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=9.0.0.0” 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.

6 comments:

  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.

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

    ReplyDelete
  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.

    ReplyDelete
  4. This worked for me as well. Thanks!

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

    ReplyDelete
  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

    ReplyDelete