[英]Error on Enable-Migrations
我是EF的新手,当我尝试在PMC控制台中运行Enable-Migrations时出现错误:使用“1”参数调用“LoadFrom”的异常:
"Could not load file or assembly 'file:///...\pa
ckages\EntityFramework.6.0.1\tools\EntityFramework.PowerShell.Utility.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)"
At ...\packages\EntityFramework.6.1.1\tools\EntityFramework.psm1:780 char:62
+ $utilityAssembly = [System.Reflection.Assembly]::LoadFrom <<<< ((Join-Path $ToolsPath EntityFramework.PowerShell.Utility.dll))
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
You cannot call a method on a null-valued expression.
At ...\packages\EntityFramework.6.1.1\tools\EntityFramework.psm1:781 char:50
+ $dispatcher = $utilityAssembly.CreateInstance <<<< (
+ CategoryInfo : InvalidOperation: (CreateInstance:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Exception calling "CreateInstanceFrom" with "8" argument(s): "Could not load file or assembly 'file:///...\packages\EntityFramework.6.0.1\tools\EntityFramework.PowerShell.dll' or one of its dependencies. Operation is no t supported. (Exception from HRESULT: 0x80131515)"
At ...\packages\EntityFramework.6.1.1\tools\EntityFramework.psm1:809 char:31
+ $domain.CreateInstanceFrom <<<< (
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
我刚刚在同事的机器上碰到了这个。 解决方案是:
所以打开文件资源管理器中的解决方案文件夹,你能找到他们在“Packages”文件夹中找到的.dll然后是EntityFramework 6.0.1文件夹吗? 如果没有,有两种选择:
我有同样的问题。 我的项目存储在网络驱动器中。 我的电脑上有许多安全策略。 我将项目移动到本地硬盘驱动器,问题解决了。
似乎“EntityFramework.Powershell.utility.dll”正在使用一些powershell功能,并且系统阻止执行此类调用,可能是因为调用powershell的dll不是本地文件。
在您的情况下,请确保您没有任何安全策略或系统配置,以防止您的系统从非本地驱动器执行有问题的扩展(EntityFramework.Powershell.utility.dll)
面临类似的问题。 问题的原因是我的代码从一台机器转移到另一台机器......删除然后重新安装实体框架解决了这个问题。
从Package Manager控制台或浏览器更新实体包。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.