加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 启用 – 迁移时出错

发布时间:2020-12-15 04:05:56 所属栏目:百科 来源:网络整理
导读:我是EF的新手,当我尝试在PMC控制台中运行Enable-Migrations时出错: 使用“1”参数调用“LoadFrom”的异常: "Could not load file or assembly 'file:///...packagesEntityFramework.6.0.1toolsEntityFramework.PowerShell.Utility.dll' or one of its
我是EF的新手,当我尝试在PMC控制台中运行Enable-Migrations时出错:
使用“1”参数调用“LoadFrom”的异常:
"Could not load file or assembly 'file:///...pa
ckagesEntityFramework.6.0.1toolsEntityFramework.PowerShell.Utility.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)"
At ...packagesEntityFramework.6.1.1toolsEntityFramework.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 ...packagesEntityFramework.6.1.1toolsEntityFramework.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:///...packagesEntityFramework.6.0.1toolsEntityFramework.PowerShell.dll' or one of its dependencies. Operation is no t supported. (Exception from HRESULT: 0x80131515)"
At ...packagesEntityFramework.6.1.1toolsEntityFramework.psm1:809 char:31
+     $domain.CreateInstanceFrom <<<< (
    + CategoryInfo          : NotSpecified: (:) [],MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

解决方法

我刚刚在同事的机器上碰到了这个.解决方案是:

>卸载EF NuGet包>从Web.Config / App.Config文件中手动删除实体框架部分>关闭Visual Studio>在Visual Studio中重新打开解决方案>重新安装EF NuGet包

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读