带有 NuGet 的实体框架 - init.ps1 中的导入模块错误 [英] Entity Framework with NuGet - Import-Module error in init.ps1
问题描述
这是我在启动 VS2010 时在包管理器控制台中收到的完整错误消息:
Here is the complete error message that I get in the Package Manager Console when starting VS2010:
Import-Module : 指定模块'C:Usersadam.assmanProjectpackagesEntityFramework.4.3.1 oolsEntityFramework.psd1'未加载,因为在任何模块中都找不到有效的模块文件目录.在C:Usersadam.assmanProjectpackagesEntityFramework.4.3.1 oolsinit.ps1:13字符:14
Import-Module : The specified module 'C:Usersadam.assmanProjectpackagesEntityFramework.4.3.1 oolsEntityFramework.psd1' was not loaded because no valid module file was found in any module directory. At C:Usersadam.assmanProjectpackagesEntityFramework.4.3.1 oolsinit.ps1:13 char:14
我已经使用 NuGet 在我的解决方案中的 DLL/ClassLibrary 项目上安装了实体框架.启动项目正在引用并使用此 DLL 项目.因此,我尝试使用在默认项目"下拉列表中选择的 DLL 项目从控制台运行启动命令,但这给了我相同的错误消息.
I've installed Entity Framework using NuGet, on a DLL/ClassLibrary project in my solution. The startup project is referencing and using this DLL project. I therefore tried running the startup command from the console with the DLL project selected in the dropdown "Default Project", but that gives me the same error message.
我有 NuGet 版本 1.6.21215.9133(显然是 EF 版本 4.3.1).
I have NuGet version 1.6.21215.9133 (and obviously EF version 4.3.1).
如果我尝试运行命令Enable-Migrations -EnableAutomaticMigrations",我会收到 CommandNotFoundException
,我想这是初始化错误的结果.我正在尝试使用本指南完成最简单的自动迁移形式:http://blogs.msdn.com/b/adonet/archive/2012/02/09/ef-4-3-automatic-migrations-walkthrough.aspx
If I try to run the command "Enable-Migrations -EnableAutomaticMigrations", I get a CommandNotFoundException
and I suppose it's a result from the init error. I'm trying to accomplish the simplest form of the automatic migrations, using this guide: http://blogs.msdn.com/b/adonet/archive/2012/02/09/ef-4-3-automatic-migrations-walkthrough.aspx
推荐答案
我不知道出了什么问题,但我最终通过编辑文件夹 中的文件
.init.ps1
解决了这个问题packagesEntityFramework.4.3.1 ools
I have no idea what was wrong, but I finally fixed this by editing the file init.ps1
inside the folder packagesEntityFramework.4.3.1 ools
.
我改变了这一行:
Import-Module (Join-Path $toolsPath 'EntityFramework.psd1') -ArgumentList $installPath
进入这个:
Import-Module '.packagesEntityFramework.4.3.1 oolsEntityFramework.psd1' -ArgumentList $installPath
这篇关于带有 NuGet 的实体框架 - init.ps1 中的导入模块错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!