Could not load type X from assembly Y

There are a bunch of reasons you can get this issue but one of the most difficult to find out is this:

  • You're adding methods to an assembly that is also installed in the GAC
  • You have a reference to that assembly in another project. The reference is not pointing to the GAC but to a file within a folder
  • So you can see the new methods in the objects explorer (VS), clicking the assembly twice, but you still get the exception in runtime

Tricky, isn't it?. Just remove the assembly from the GAC 🙂

Enjoyed reading this post?
Subscribe to the RSS feed and have all new posts delivered straight to you.