运行Enable-Migrations时获取错误 [英] Get error while running Enable-Migrations

查看:199
本文介绍了运行Enable-Migrations时获取错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的ASP.NET MVC5项目(Powershell v5& Visual Studio 2015)上运行启用迁移时,我收到以下错误。我试图卸载并重新安装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文件(X86)\MICROSOFT VISUAL STUDIO 14.0\COMMON7\IDE\EXTENSIONS\MSHGPU2S.W4I\Modules\NuGet\profile.ps1:126 char:5
+ $ service = [Microsoft.VisualStudio.Shell.Package] :: GetGlobalServi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >

您无法调用空值表达式的方法
在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(
+ ~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ,RuntimeException
+ FullyQualifiedErrorId:InvokeMethodOnNull



加入路径:无法绑定参数因为它为null,所以参数'Path'。
在D:\xxx\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:810 char:20
+(Join-Path $ runner.ToolsPath EntityFramework.PowerShell。 dll),
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand



解决方案

这是一个已知的错误,如果你有任何Windows 10内部预览构建从11099到14257



官方错误报告 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.0\COMMON7\IDE\EXTENSIONS\MSHGPU2S.W4I\Modules\NuGet\profile.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:\xxx\packages\EntityFramework.6.1.3\tools\EntityFramework.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:\xxx\packages\EntityFramework.6.1.3\tools\EntityFramework.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:\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 : Cannot bind argument to parameter 'Path' because it is null. At 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

You cannot call a method on a null-valued expression. At D:\xxx\packages\EntityFramework.6.1.3\tools\EntityFramework.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:\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

解决方案

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆