简体   繁体   English

实体框架迁移NuGet错误

[英]Entity Framework Migrations NuGet Error

Using Visual Studio 2013 Express Preview for Web and Entity Framework 5 使用Visual Studio 2013 Express Preview for Web和Entity Framework 5

I'm getting the following error when I attempt to enable migrations: 我尝试启用迁移时收到以下错误:

PM> Enable-Migrations System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Shell, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. PM> Enable-Migrations System.IO.FileNotFoundException:无法加载文件或程序集“Microsoft.VisualStudio.Shell,Version = 10.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a”或其依赖项之一。 The system cannot find the file specified. 该系统找不到指定的文件。 File name: 'Microsoft.VisualStudio.Shell, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' at System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetProjectTypes(Project project) at System.Data.Entity.Migrations.Extensions.ProjectExtensions.IsWebSiteProject(Project project) at System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetTargetDir(Project project) at System.Data.Entity.Migrations.MigrationsDomainCommand.GetFacade(String configurationTypeName) at System.Data.Entity.Migrations.EnableMigrationsCommand.FindContextToEnable(String contextTypeName) at System.Data.Entity.Migrations.EnableMigrationsCommand.<>c_ DisplayClass2.<.ctor>b _0() at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command) 文件名:System.Data.Entity.Migrations上的System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetProjectTypes(项目项目)中的'Microsoft.VisualStudio.Shell,Version = 10.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a' System.Data.Entity上System.Data.Entity.Migrations.MigrationsDomainCommand.GetFacade(String configurationTypeName)的System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetTargetDir(项目项目)中的.Extensions.ProjectExtensions.IsWebSiteProject(项目项目) System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action命令)中System.Data.Entity.Migrations.EnableMigrationsCommand。<> c_ DisplayClass2。<。ctor> b _0()的.Migrations.EnableMigrationsCommand.FindContextToEnable(String contextTypeName)

Could not load file or assembly 'Microsoft.VisualStudio.Shell, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. 无法加载文件或程序集'Microsoft.VisualStudio.Shell,Version = 10.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'或其依赖项之一。 The system cannot find the file specified. 该系统找不到指定的文件。 PM> PM>

Any suggestions? 有什么建议?

我有同样的问题,最后通过安装“Microsoft Visual Studio 2012 Shell Redistributable Package(隔离)”( http://www.microsoft.com/en-us/download/details.aspx?id=30670 )解决了这个问题。

I tried the Redistributable Package mentioned earlier and it did not fix the error. 我尝试了前面提到的Redistributable Package,它没有修复错误。 Simply updating the Entity Framework through the NuGet Package Manager did the trick for me. 只需通过NuGet包管理器更新实体框架就可以解决这个问题。

The issue is also explained here: https://connect.microsoft.com/VisualStudio/feedback/details/805933/filenotfoundexception-enabling-ef-migration 这个问题也在这里解释: https//connect.microsoft.com/VisualStudio/feedback/details/805933/filenotfoundexception-enabling-ef-migration

It says it is fixed with vs2013 update 2. But I just tested it with windows 8.1 and update 2 but could still reproduce this. 它说它是用vs2013更新2修复的。但我刚用Windows 8.1和更新2进行了测试,但仍然可以重现这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM