Here’s The Deal When Your Code Compiles But At Runtime It Can’t Find Some TFS Assemblies
I have run into this twice now. Both on the same project but different branches. The second time was about 6 weeks after the first and I could not remember where or when I had seen it first I just knew that I had. The steps go like this:
The solution compiles clean.
You go to run the solution and it may start running if it doesn’t have an immediate reliance on a TFS assembly. As soon as the application needs to load a TeamFoundation assembly it dies with the following exception:
"Could not load file or assembly 'Microsoft.TeamFoundation, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.":"Microsoft.TeamFoundation, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
As it turns out I am working on an x64 machine and the Solution Platform was set to Any CPU or Mixed Platforms
I needed to open up the Solution Configuration and create an x86 platform configuration and then set each project to the x86 Platform (both debug and release). Then when I compile I ensure I have the x86 selected as the Solution Platform.
Voila! The code now runs on my x64 machine.