I have a solution that uses EF Code First. I recently upgraded all my projects to EF 4.3 (using NuGet). However, afterwards I discovered that another package (EFHooks) doesn’t work with that version.
So I decided to roll back the version to 4.1.10715.0 which is the latest version that I could get to work with EFHooks.
When I compile the application, everything compiles fine. I can run all my tests and they pass (unit tests, integration tests, database tests, etc.). However, when I run the web site (mvc 3), it gives me a runtime error stating
Could not load file or assembly ‘EntityFramework’ or one of its
dependencies. … Version=4.3.0.0 etc etc
I’ve checked all my packages.config, and my web.config. I’ve checked all the referenced dlls versions. Everything is lined up with 4.1.
I can’t find anywhere in my solution that uses anything for 4.3, yet the site is trying to find it because of something.
Is there something in my rollback that I missed?
It turns out that the real error was that I didn’t have my DBContext wired up to my IoC container. In this case, Ninject.
So when the DBContext was requested the IoC container errored out, because it didn’t have one wired up to give to the application.
I do not understand why it gave me the error that it did, but for anyone going through the same steps, I hope this might prove useful if you find yourself in the same place that I did.
So, all the code I needed to add was basically just the following: