init.ps1中出现带有NuGet-Import模块的实体框架错误



以下是启动VS2010:时在Package Manager控制台中收到的完整错误消息

导入模块:指定的模块'C:\Users\adam.assman\Project\packages\EntityFramework.4.3\tools\EntityFramework.psd1'未加载,因为在任何模块中都找不到有效的模块文件目录在C: \Users\adam.assman\Project\packages\EntityFramework.4.3\tools\init.ps1:13字符:14

我已经使用NuGet在我的解决方案中的DLL/ClassLibrary项目上安装了实体框架。启动项目正在引用并使用此DLL项目。因此,我尝试从控制台运行启动命令,在下拉菜单"默认项目"中选择DLL项目,但这会给我同样的错误消息。

我有NuGet版本1.6.21215.9133(显然还有EF版本4.3.1)

如果我尝试运行命令"Enable-Migrations-EnableAutomaticMigrations",我会得到一个CommandNotFoundException,我想这是init错误的结果。我正在尝试使用以下指南来完成最简单形式的自动迁移:http://blogs.msdn.com/b/adonet/archive/2012/02/09/ef-4-3-automatic-migrations-walkthrough.aspx

我不知道出了什么问题,但我最终通过编辑文件夹packagesEntityFramework.4.3.1tools中的文件init.ps1解决了这个问题。

我改了这行:

Import-Module (Join-Path $toolsPath 'EntityFramework.psd1') -ArgumentList $installPath

进入:

Import-Module '.packagesEntityFramework.4.3.1toolsEntityFramework.psd1' -ArgumentList $installPath

最新更新