Friday, August 27, 2010
Came across this error writing unit tests using MSTest in Visual Studio 2008. The source of the problem was I had two versions of the same dll in the GAC. Removing the older version fixed the problem. The reason why I was only seeing this error during runtime and not during compilation is the test project referenced the assembly it was testing in the bin directory of the project which is why the build succeeded. However, during runtime the tests referenced the assembly in the GAC before the assembly in the bin of the project which is expected.