I have a WinForms
application that references a data model class library in the same solution. This class library uses Entity Framework 5
. So far it works great.
I would also like to reference an external class library that uses Entity Framework 6
, but at this point, as expected, I get the System.IO.FileLoadException: Could not load file or assembly 'EntityFramework, Version=6.0.0.0...
From what I understood, I have two options (or maybe more):
1) Upgrade or downgrade one of the two, so they both use the same version of EF (downgrade is probably not a good idea).
2) Make my solution to be able to support both versions (that's my preferred option)
Now at this point I am getting stuck, because I am not sure how I can add references to EF5 and EF6, as both DLLs are called EntityFramework.dll
.
I also saw these questions: Different EntityFramework versions in same solution
Could not load file or assembly 'EntityFramework' after downgrading EF 5.0.0.0 --> 4.3.1.0
But it's still not clear to me exactly how to do it. I can see that I need to add a dependent assembly in my app config.
Just to clarify, this is the project structure that I have:
- Main application
- Data model class library (uses EF5 and it is referenced by the Main application)
- External class library (uses EF6 and it is referenced by the Main application)
Is anybody able to help with that?