Asp.net mvc3 application opened in Visual Studio 2012 could not find assembly "EntityFramework"

I opened and edited the ASP.NET MVC 3 application developed in Visual Studio 2010 in Visual Studio 2012. It worked fine in debug mode, but when I tried to publish it (release mode), it failed and threw the following warnings and errors.

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "EntityFramework". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. error CS0234: The type or namespace name 'Infrastructure' does not exist in the namespace 'System.Data.Entity' (are you missing an assembly reference?) error CS0246: The type or namespace name 'DbContext' could not be found (are you missing a using directive or an assembly reference?) error CS0246: The type or namespace name 'DbModelBuilder' could not be found (are you missing a using directive or an assembly reference?) error CS0246: The type or namespace name 'DbSet' could not be found (are you missing a using directive or an assembly reference?) 

EntityFramework.dll is present in the bin folder and EntityFramework 5.0 is installed. Can this be solved?

What am I doing wrong during the migration of this project? Microsoft says no changes are required when moving from VS 2010 to VS 2012 http://msdn.microsoft.com/en-us/library/vstudio/jj161050.aspx#ASP .

+4
source share
1 answer

If the project has a file called package.config, open it and remove the link to EntityFramework (something like <package id="EntityFramework" ... /> ). Also remove the assembly reference from the project (select the assembly in the Links section and delete it) and remove the assembly from the bin folder.

Now you can reinstall the package using the package manager (right-click the project and select "Manage NuGet Packages").

0
source

Source: https://habr.com/ru/post/1495168/


All Articles