Found conflicts between different versions of the same dependent assembly.MVC3 -> MVC4 / EF4 -> EF5
Solution 1
You can build your solution in diagnostic mode to get more detailed information about the error.
Open the VS Options dialog (Tools > Options), navigate to the "Projects and Solutions" node and select "Build and Run". Change the MS Build project build output verbosity to Diagnostic.
Have a look here.
Solution 2
If you look at the build message, it states the 4.0 version of the .net framework is referenced... Is there a setting in your project file or web/app.config specifying a conflicting version of the .net framework?
Are you familiar with fuslog? you can set it up to log all assembly bindings that .net is doing while running your application. You should then be able to see detailed information on what is getting bound when. If you still can't figure it out, you can always do a binding redirect on that .dll in the web.config.
http://msdn.microsoft.com/en-us/library/eftw1fys.aspx -- binding redirects
http://msdn.microsoft.com/en-us/library/e74a18c4(v=vs.71).aspx -- fusion log viewer
Set up fusion logger and take a look at what the output is. If you don't get an answer from that, try the binding redirect (which would give you at least a temporary solution).
Y Haber
I develop Line of Business applications for Private Companies.
Updated on June 11, 2022Comments
-
Y Haber almost 2 years
The question is how to resolve conflicts between versions of assemblies in my project that was upgraded to MVC4 and EF5?
The problem is manifest in the fact that my controllers and models can include System.Data.Objects, but now my views.
I am using MVC 4, my project was upgraded from MVC 3.
Entity Framework is version 5.
I have a controller that is able to use objectcontext from System.Data.Objects.
My Usings: using System.Data.Objects; using System.Data.Entity;
When I try to include the using in the view form System.Data.Objects, I get :
CS0234: The type or namespace name 'Objects' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
I am targeting .net 4.5
My Build Displays this message: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1561,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly.
-
Y Haber almost 12 yearsI'm not sure how to find out what is referencing what. The project properties are referencing .Net 4.5. How do I track this down? There's only one System.Data.Entity DLL in the references.
-
Y Haber almost 12 yearsLooks like the view is accessing the Entity Framework 5 Version of system.data.entity and the controller is accessing version 4, which has system.data.objects. How do I 1) make sure the whole project is using the new assemblies. 2) Get to object context on the version 5 EF?
-
Y Haber almost 12 yearsWeird - the model has no problem accessing objectcontext either.
-
theMothaShip almost 12 years@YHaber I updated my answer with some helpful information that might help you track down your binding problems. Let me know if you figure something out!
-
theMothaShip almost 12 years@YHaber Did you end up figuring this out using the tools mentioned?
-
Laurence almost 11 yearsDiagnostics mode tells you exactly which dlls are pulling in the other versions too. Very helpful.
-
David Sherret about 10 yearsJust a note, once you get the build output do a search for the word "conflict" in the output window and you will find the issue.