错误上启用的迁移 [英] Error on Enable-Migrations

查看:169
本文介绍了错误上启用的迁移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新与EF和我有一个错误,当我尝试运行启用的迁移在PMC控制台:
异常调用LoadFrom和1的说法(S):

 无法加载文件或程序集文件:/// ... \\ PA
ckages \\ EntityFramework.6.0.1 \\工具\\ EntityFramework.PowerShell.Utility.dll'或它的一个依赖。不支持操作。 (异常来自HRESULT:0x80131515)
在... \\包\\ EntityFramework.6.1.1 \\工具\\ EntityFramework.psm1:780字符:62
+ $ utilityAssembly = [System.Reflection.Assembly] :: LoadFrom<<<< ((联接路径$ ToolsPath EntityFramework.PowerShell.Utility.dll))
    + CategoryInfo:NotSpecified:(:) [],MethodInvocationException
    + FullyQualifiedErrorId:DotNetMethodException你不能调用一个空值前pression的方法。
在... \\包\\ EntityFramework.6.1.1 \\工具\\ EntityFramework.psm1:781字符:50
+ $调度= $ utilityAssembly.CreateInstance<<<< (
    + CategoryInfo:InvalidOperation:(的CreateInstance:字符串)[],的RuntimeException
    + FullyQualifiedErrorId:InvokeMethodOnNull异常调用CreateInstanceFrom和8的说法(S):无法加载文件或程序集文件:/// ... \\包\\ EntityFramework.6.0.1 \\工具\\ EntityFramework.PowerShell.dll'或之一。其依赖的操作是没有牛逼的支持(从HRESULT异常:0x80131515)。
在... \\包\\ EntityFramework.6.1.1 \\工具\\ EntityFramework.psm1:809字符:31
+ $ domain.CreateInstanceFrom<<<< (
    + CategoryInfo:NotSpecified:(:) [],MethodInvocationException
    + FullyQualifiedErrorId:DotNetMethodException


解决方案

所以openn在文件浏览器解决方案文件夹,你可以找到他们在包的文件夹找那么的EntityFramework 6.0.1文件夹中的.dll?如果不是,有两种选择:


  1. 检查源代码控制服务器,则它不会下载到本地工作区的可能性。如果是这样,只是手动让他们从源头控制Explorer如果你正在使用TFS。

  2. 如果文件不是源代码控制服务器在任,我会建议卸载EF 6.0.1的NuGet,然后手动删除有关在上面的包文件夹EF整个文件夹,然后重新安装。

I'm new with EF and I have an error when I try to run Enable-Migrations in PMC console : Exception calling "LoadFrom" with "1" argument(s):

 "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

解决方案

So openn the solution folder in file explorer, can you find the .dlls they are looking for in "Packages" folder then EntityFramework 6.0.1 folder? If not, there are two options:

  1. Check your source control server, there is a possibility it was not downloaded to local workspace. if so, just get them manually from source control explorer if you are using TFS.
  2. If the files were not on source control server either, I would recommend to uninstall EF 6.0.1 nuget, then manual delete the whole folder about ef in the Package folder above, and then reinstall it.

这篇关于错误上启用的迁移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆