【问题标题】:Enable-Migrations Command giving ErrorEnable-Migrations 命令给出错误
【发布时间】:2017-09-14 05:50:49
【问题描述】:

我正在研究 ASP.Net 样板框架,现在该机器在我工作的地方不可用,但我的 Google 驱动器上有备份。我怎样才能正确使用该备份?数据库创建,项目运行等???我在启用迁移和更新数据库命令时遇到错误

 Exception calling "LoadFrom" with "1" argument(s): "Could not load file or assembly 'file:///F:\Qubit 
 Systems\ShipperBuyerV1\module-zero-template-2.1.1\src\packages\EntityFramework.6.1.3\tools\EntityFramework.PowerShell.Utility.dll' or one of its dependencies. Operation is not supported. 
(Exception from HRESULT: 0x80131515)"
At F:\Qubit Systems\ShipperBuyerV1\module-zero-template-2.1.1\src\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:780 char:5
+     $utilityAssembly = [System.Reflection.Assembly]::LoadFrom((Join-P ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : FileLoadException

You cannot call a method on a null-valued expression.
 At F:\Qubit Systems\ShipperBuyerV1\module-zero-template-2.1.1\src\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:781 char:5
+     $dispatcher = $utilityAssembly.CreateInstance(
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

 Exception calling "CreateInstanceFrom" with "8" argument(s): "Could not load file or assembly 'file:///F:\Qubit 
 Systems\ShipperBuyerV1\module-zero-template-2.1.1\src\packages\EntityFramework.6.1.3\tools\EntityFramework.PowerShell.dll' or one of its       dependencies. Operation is not supported. (Exception 
from HRESULT: 0x80131515)"
At F:\Qubit Systems\ShipperBuyerV1\module-zero-template-2.1.1\src\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:809 char:5
+     $domain.CreateInstanceFrom(
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : FileLoadException

【问题讨论】:

  • 检查是否有这个文件:F:\Qubit Systems\ShipperBuyerV1\module-zero-template-2.1.1\src\packages\EntityFramework.6.1.3\tools\EntityFramework.PowerShell.Utility。 dll
  • 是的,这个文件存在于给定的路径中。现在该怎么办? @Alper 先生

标签: c# entity-framework entity-framework-migrations aspnetboilerplate asp.net-boilerplate


【解决方案1】:

使用包管理器,重新安装实体框架:

Uninstall-Package EntityFramework -Force

然后为每个项目安装它:

Install-Package EntityFramework

重新启动 Visual Studio。

【讨论】:

  • 查看此主题以获取更多信息 -> stackoverflow.com/questions/12318107/…
  • Sir @Alper 再次安装实体框架时出现此错误文件 F:\Qubit Systems\ShipperBuyerV1\module-zero-template-2.1.1\src\packages\EntityFramework.6.1.3\tools \install.ps1 无法加载,因为在此系统上禁用了运行脚本。
  • @Alper 先生 "install.p‌​s1"
【解决方案2】:

你可以试试:

  • 以管理员身份运行 VS
  • 清理和重建
  • 删除 obj 文件夹

在某些情况下,您可以使用 Update-Package -Reinstall 来完成重新安装所有包

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-04-25
    • 1970-01-01
    • 2019-03-29
    • 2014-12-01
    • 2017-10-18
    • 1970-01-01
    • 2016-04-04
    相关资源
    最近更新 更多