[英]asp.net mvc3 application opened in Visual Studio 2012, Could not locate the assembly “EntityFramework”
I opened and edited an ASP.NET MVC 3 application developed in Visual Studio 2010, in Visual Studio 2012. It was working fine in Debug mode but when I tried to publish it (release mode), it failed and threw following warnings and errors. 我在Visual Studio 2012中打开并编辑了在Visual Studio 2010中开发的ASP.NET MVC 3应用程序。它在调试模式下工作正常但是当我尝试发布它(发布模式)时,它失败并抛出以下警告和错误。
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 bin folder and EntityFramework 5.0 is installed. EntityFramework.dll存在于bin文件夹中,并且已安装EntityFramework 5.0。 Can this be resolved ?
这可以解决吗?
What am I doing wrong while migrating this project? 迁移这个项目时我做错了什么? Microsoft says no modifications are needed when going from VS 2010 to VS 2012 http://msdn.microsoft.com/en-us/library/vstudio/jj161050.aspx#ASP .
微软表示从VS 2010到VS 2012时不需要进行任何修改http://msdn.microsoft.com/en-us/library/vstudio/jj161050.aspx#ASP 。
If there is a file called packages.config in the project, open it and remove the reference to EntityFramework (something like <package id="EntityFramework" ... />
). 如果项目中有一个名为packages.config的文件,请打开它并删除对EntityFramework的引用(类似
<package id="EntityFramework" ... />
)。 Also remove the reference to the assembly from the project (select the assembly under 'References' and delete it) and remove the assembly from the bin folder. 同时从项目中删除对程序集的引用(在“引用”下选择程序集并将其删除),然后从bin文件夹中删除程序集。
Now you can reinstall the package using the package manager (right click the project and select "Manage NuGet Packages"). 现在,您可以使用包管理器重新安装包(右键单击项目并选择“Manage NuGet Packages”)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.