运行 Enable-Migrations 时出错 [英] Get error while running Enable-Migrations
问题描述
在我的 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.0COMMON7IDEEXTENSIONSMSHGPU2S.W4IModulesNuGetprofile.ps1:126 char:5+ $service = [Microsoft.VisualStudio.Shell.Package]::GetGlobalServi ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidArgument: (:) [], RuntimeException+ FullQualifiedErrorId : 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:xxxpackagesEntityFramework.6.1.3 oolsEntityFramework.psm1:1004 char:5+ $packageInstallerServices = $componentModel.GetService([NuGet.Vis ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidArgument: (:) [], RuntimeException+ FullQualifiedErrorId : AmbiguousTypeReference
您不能在空值表达式上调用方法.在 D:xxxpackagesEntityFramework.6.1.3 oolsEntityFramework.psm1:1006 char:5+ $vsPackage = $packageInstallerServices.GetInstalledPackages() |?...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidOperation: (:) [], RuntimeException+ FullQualifiedErrorId : InvokeMethodOnNull
Join-Path:无法将参数绑定到参数路径",因为它为空.在 D:xxxpackagesEntityFramework.6.1.3 oolsEntityFramework.psm1:713 字符:28+ $toolsPath = 加入路径 $installPath 工具+ ~~~~~~~~~~~~+ CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException+ FullQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
Join-Path:无法将参数绑定到参数路径",因为它为空.在 D:xxxpackagesEntityFramework.6.1.3 oolsEntityFramework.psm1:780 字符:74+ ... [System.Reflection.Assembly]::LoadFrom((Join-Path $ToolsPath EntityF ...+ ~~~~~~~~~~+ CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException+ FullQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
您不能在空值表达式上调用方法.在 D:xxxpackagesEntityFramework.6.1.3 oolsEntityFramework.psm1:781 字符:5+ $dispatcher = $utilityAssembly.CreateInstance(+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidOperation: (:) [], RuntimeException+ FullQualifiedErrorId : InvokeMethodOnNull
Join-Path:无法将参数绑定到参数路径",因为它为空.在 D:xxxpackagesEntityFramework.6.1.3 oolsEntityFramework.psm1:810 字符:20+ (Join-Path $runner.ToolsPath EntityFramework.PowerShell.dll),+ ~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException+ FullQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
如果您拥有从 11099 到 14257 的任何 Windows 10 Insider Preview 版本,这是一个已知错误
官方错误报告 https://entityframework.codeplex.com/workitem/2872>
I got below error while running Enable-Migrations on my ASP.NET MVC5 project (Powershell v5 & Visual Studio 2015). I have tried to uninstall and re-install EntityFramework (v6.1.3) but no lucky. Does anyone know how to solve it?
Type name 'Microsoft.VisualStudio.Shell.Package' is ambiguous, it could be 'Microsoft.VisualStudio.Shell.Package, Microsoft.VisualStudio.Shell.14.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or 'Microsoft.VisualStudio.Shell.Package, Microsoft.VisualStudio.Shell.11.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. At C:PROGRAM FILES (X86)MICROSOFT VISUAL STUDIO 14.0COMMON7IDEEXTENSIONSMSHGPU2S.W4IModulesNuGetprofile.ps1:126 char:5 + $service = [Microsoft.VisualStudio.Shell.Package]::GetGlobalServi ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [], RuntimeException + FullyQualifiedErrorId : AmbiguousTypeReference
Type name 'NuGet.VisualStudio.IVsPackageInstallerServices' is ambiguous, it could be 'NuGet.VisualStudio.IVsPackageInstallerServices, Microsoft.VisualStudio.ApplicationInsights, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or 'NuGet.VisualStudio.IVsPackageInstallerServices, Microsoft.VisualStudio.Web.Application, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. At D:xxxpackagesEntityFramework.6.1.3 oolsEntityFramework.psm1:1004 char:5 + $packageInstallerServices = $componentModel.GetService([NuGet.Vis ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [], RuntimeException + FullyQualifiedErrorId : AmbiguousTypeReference
You cannot call a method on a null-valued expression. At D:xxxpackagesEntityFramework.6.1.3 oolsEntityFramework.psm1:1006 char:5 + $vsPackage = $packageInstallerServices.GetInstalledPackages() | ? ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull
Join-Path : Cannot bind argument to parameter 'Path' because it is null. At D:xxxpackagesEntityFramework.6.1.3 oolsEntityFramework.psm1:713 char:28 + $toolsPath = Join-Path $installPath tools + ~~~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
Join-Path : Cannot bind argument to parameter 'Path' because it is null. At D:xxxpackagesEntityFramework.6.1.3 oolsEntityFramework.psm1:780 char:74 + ... [System.Reflection.Assembly]::LoadFrom((Join-Path $ToolsPath EntityF ... + ~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
You cannot call a method on a null-valued expression. At D:xxxpackagesEntityFramework.6.1.3 oolsEntityFramework.psm1:781 char:5 + $dispatcher = $utilityAssembly.CreateInstance( + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull
Join-Path : Cannot bind argument to parameter 'Path' because it is null. At D:xxxpackagesEntityFramework.6.1.3 oolsEntityFramework.psm1:810 char:20 + (Join-Path $runner.ToolsPath EntityFramework.PowerShell.dll), + ~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
This is a known bug if you have any of the Windows 10 Insider Preview builds from 11099 to 14257
Official bug report https://entityframework.codeplex.com/workitem/2872
这篇关于运行 Enable-Migrations 时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!