gpt4 book ai didi

entity-framework - 当我尝试在 EF 4.3.1 中启用迁移时引发异常

转载 作者:行者123 更新时间:2023-12-04 01:30:43 26 4
gpt4 key购买 nike

我在我的 .Net 4.0 类库项目中使用 nuget 安装的 Entity Framework 4.3.1。在这种情况下,当我在 PM 控制台中调用“Enable-Migrations”命令时,我收到以下异常:

Exception calling "LoadFrom" with "1" argument(s): "Nelze načíst soubor nebo sestavení file:///D:\ Users\DvoracekR\Documents\Visual Studio 2010\Projects\WebCameras\packages\EntityFramework.4.3.1\to ols\EntityFramework.PowerShell.Utility.dll nebo jeden z jejich závislých prvků. Systém nemůže nalé zt uvedený soubor." At D:\Users\DvoracekR\Documents\Visual Studio 2010\Projects\WebCameras\packages\EntityFramework.5. 0.0-rc\tools\EntityFramework.psm1:393 char:62 + $utilityAssembly = [System.Reflection.Assembly]::LoadFrom <<<< ((Join-Path $toolsPath Entity Framework.PowerShell.Utility.dll)) + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : DotNetMethodException

You cannot call a method on a null-valued expression. At D:\Users\DvoracekR\Documents\Visual Studio 2010\Projects\WebCameras\packages\EntityFramework.5. 0.0-rc\tools\EntityFramework.psm1:394 char:50 + $dispatcher = $utilityAssembly.CreateInstance <<<< ( + CategoryInfo : InvalidOperation: (CreateInstance:String) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull

Exception calling "CreateInstanceFrom" with "8" argument(s): "Typ System.Data.Entity.Migrations.En ableMigrationsCommand ze sestavení EntityFramework.PowerShell, Version=4.3.1.0, Culture=neutral, P ublicKeyToken=b77a5c561934e089 nelze načíst." At D:\Users\DvoracekR\Documents\Visual Studio 2010\Projects\WebCameras\packages\EntityFramework.5. 0.0-rc\tools\EntityFramework.psm1:418 char:31>+ $domain.CreateInstanceFrom <<<< ( + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : DotNetMethodException

最佳答案

我解决了上述问题。

  • 我使用 NuGet 包管理器卸载了 Entity Framework 。
  • 我手动清除了包中以“Entity”开头的子目录
    目录。
  • 我再次安装了 Entity Framework 4.3.1

  • 现在迁移已正确启用。

    关于entity-framework - 当我尝试在 EF 4.3.1 中启用迁移时引发异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10999561/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com