运行Enable-Migrations时出错

问题描述 投票:8回答:1

我在ASP.NET MVC5项目(Powershell v5和Visual Studio 2015)上运行Enable-Migrations时出现以下错误。我试图卸载并重新安装EntityFramework(v6.1.3),但没有幸运。有谁知道如何解决它?

类型名称'Microsoft.VisualStudio.Shell.Package'不明确,可能是'Microsoft.VisualStudio.Shell.Package,Microsoft.VisualStudio.Shell.14.0,Version = 14.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'或' Microsoft.VisualStudio.Shell.Package,Microsoft.VisualStudio.Shell.11.0,Version = 14.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'。在C:\ PROGRAM FILES(X86)\ MICROSOFT VISUAL STUDIO 14.0 \ COMMON7 \ IDE \ EXTENSIONS \ MSHGPU2S.W4I \ Modules \ NuGet \ profile.ps1:126 char:5 + $ service = [Microsoft.VisualStudio.Shell.Package] :: GetGlobalServi ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo:InvalidArgument:(:) [],RuntimeException + FullyQualifiedErrorId:AmbiguousTypeReference

类型名称'NuGet.VisualStudio.IVsPackageInstallerServices'不明确,可能是'NuGet.VisualStudio.IVsPackageInstallerServices,Microsoft.VisualStudio.ApplicationInsights,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'或'NuGet.VisualStudio.IVsPackageInstallerServices, Microsoft.VisualStudio.Web.Application,Version = 14.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'。在D:\ xxx \ packages \ EntityFramework.6.1.3 \ tools \ EntityFramework.psm1:1004 char:5 + $ packageInstallerServices = $ componentModel.GetService([NuGet.Vis ... + ~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ + CategoryInfo:InvalidArgument:(:) [],RuntimeException + FullyQualifiedErrorId:AmbiguousTypeReference

您无法在空值表达式上调用方法。在D:\ xxx \ packages \ EntityFramework.6.1.3 \ tools \ EntityFramework.psm1:1006 char:5 + $ vsPackage = $ packageInstallerServices.GetInstalledPackages()| ? ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~ + CategoryInfo:InvalidOperation :( :) [],RuntimeException + FullyQualifiedErrorId:InvokeMethodOnNull

Join-Path:无法将参数绑定到参数'Path',因为它为null。在D:\ xxx \ packages \ EntityFramework.6.1.3 \ tools \ EntityFramework.psm1:713 char:28 + $ toolsPath = Join-Path $ installPath tools + ~~~~~~~~~~~~ + CategoryInfo: InvalidData:(:) [Join-Path],ParameterBindingValidationException + FullyQualifiedErrorId:ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand

Join-Path:无法将参数绑定到参数'Path',因为它为null。在D:\ xxx \ packages \ EntityFramework.6.1.3 \ tools \ EntityFramework.psm1:780 char:74 + ... [System.Reflection.Assembly] :: LoadFrom((Join-Path $ ToolsPath EntityF ... + ~~~~~~~~~~ + CategoryInfo:InvalidData :( :) [Join-Path],ParameterBindingValidationException + FullyQualifiedErrorId:ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand

您无法在空值表达式上调用方法。在D:\ xxx \ packages \ EntityFramework.6.1.3 \ tools \ EntityFramework.psm1:781 char:5 + $ dispatcher = $ utilityAssembly.CreateInstance(+ ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo:InvalidOperation :( :) [],RuntimeException + FullyQualifiedErrorId:InvokeMethodOnNull

Join-Path:无法将参数绑定到参数'Path',因为它为null。在D:\ xxx \ packages \ EntityFramework.6.1.3 \ tools \ EntityFramework.psm1:810 char:20 +(Join-Path $ runner.ToolsPath EntityFramework.PowerShell.dll),+ ~~~~~~~~~ ~~~~~~~~ + CategoryInfo:InvalidData :( :) [Join-Path],ParameterBindingValidationException + FullyQualifiedErrorId:ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand

powershell visual-studio-2015 entity-framework-6 powershell-v5.0
1个回答
3
投票

如果您有11099到14257之间的任何Windows 10 Insider预览版本,则这是一个已知错误

官方错误报告https://entityframework.codeplex.com/workitem/2872

© www.soinside.com 2019 - 2024. All rights reserved.