views:

34

answers:

2

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 inherits 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?

+2  A: 

I've run into similar problems. delete everything in the bin folder, clean the solution and rebuild.

Patricia
I thought those issues were way in the past -- I used to do that with VC++, but haven't ever run into it before with C#. Thanks, I will try that now!
Dave
That absolutely did the trick, thanks! I can't believe this is still something that has to be done. Can anyone explain why this is the case?
Dave
I have no idea what the actual reason is, but somewhere some references don't get updated. glad the fix worked for ya :)
Patricia
+2  A: 

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

David M