我在我的 .Net 4.0 类库项目中使用 nuget 安装的实体框架 4.3.1。在这种情况下,当我在 PM 控制台中调用“Enable-Migrations”命令时,会收到以下异常:
使用“1”参数调用“LoadFrom”的异常:“Nelze načíst soubor nebo sestavení file:///D:\ Users\DvoracekR\Documents\Visual Studio 2010\Projects\WebCameras\packages\EntityFramework.4.3.1\到 ols\EntityFramework.PowerShell.Utility.dll nebo jeden z jejich závislých prvků. Systém nemůže nalé zt uvedený soubor。在 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
您不能在空值表达式上调用方法。在 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
使用“8”参数调用“CreateInstanceFrom”的异常:“Typ System.Data.Entity.Migrations.EnableMigrationsCommand ze sestavení EntityFramework.PowerShell, Version=4.3.1.0, Culture=neutral, P ublicKeyToken=b77a5c561934e089 nelze načíst。” 在 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