I decided to modify some code today, and encountered an error that doesn't make any sense to me. I have an interface called IDatabase
and a class that inheri开发者_开发知识库ts from it, called Database
. I originally just put IDatabase
in the same assembly as Database
, but I didn't like this because it would prevent another person from creating a new type of IDatabase
without having the entire assembly. I moved IDatabase into a new, separate assembly called LibraryInterfaces
, and changed all of my references in the project.
The project compiles fine, but when I execute it, I get the error:
Could not load type 'Company.Database.IDatabase' from assembly 'Company.Database'.
This doesn't make any sense to me, because I moved IDatabase
's definition to LibraryInterfaces
! I double checked the files in the folder that is being run from, and the files are correct. I even opened them up in Reflector, just to double-check all of the references, and those are correct as well. I have also removed my using
statement and have fully qualified all usage of IDatabase
, and even that didn't do the trick!
Does anyone have tips for correcting this issue?
I've run into similar problems. delete everything in the bin folder, clean the solution and rebuild.
You may have changed all your references, but do some of those references in turn reference the old assembly? This is one of the things the open source project Refix should be able to solve before too long (apologies for the shameless plug).
精彩评论