Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Found conflicts between different versions of the same dependent assembly.MVC3 -> MVC4 / EF4 -> EF5

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.

like image 265
Y Haber Avatar asked Jun 26 '12 22:06

Y Haber


2 Answers

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.

like image 83
Joe Avatar answered Nov 05 '22 15:11

Joe


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

like image 34
theMothaShip Avatar answered Nov 05 '22 17:11

theMothaShip