8

在我的 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,版本=14.0.0.0,文化=中性,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,版本=14.0.0.0,文化=中性,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

加入路径:无法将参数绑定到参数“路径”,因为它为空。在 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

加入路径:无法将参数绑定到参数“路径”,因为它为空。在 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

加入路径:无法将参数绑定到参数“路径”,因为它为空。在 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

4

1 回答 1

3

如果您拥有从 11099 到 14257 的任何 Windows 10 Insider Preview 版本,则这是一个已知错误

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

于 2016-01-28T12:08:40.560 回答