【发布时间】:2016-06-22 01:53:39
【问题描述】:
几乎每次我尝试为 EF 迁移运行 update-database 命令时,我都会在 Visual Studio 2015 中收到以下错误:
使用“1”个参数调用“GetService”的异常:“异常 使用“2”个参数调用“Invoke”:“Visual Studio 组件 缓存已过期。请重新启动 Visual Studio。视觉工作室 组件缓存已过期。请重新启动 Visual Studio。"" 在 D:\Dev\Project\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:1004 字符:5 + $packageInstallerServices = $componentModel.GetService([NuGet.Vis ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : ScriptMethodRuntimeException 您不能在空值表达式上调用方法。在 D:\Dev\Project\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:1006 字符:5 + $vsPackage = $packageInstallerServices.GetInstalledPackages() | ? ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId:InvokeMethodOnNull Join-Path:无法将参数绑定到参数“路径”,因为它为空。在 D:\Dev\Project\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:713 字符:28 + $toolsPath = 加入路径 $installPath 工具 +~~~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand 加入路径:无法将参数绑定到参数“路径”,因为它是 空值。在 D:\Dev\Project\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:780 字符:74 + ... [System.Reflection.Assembly]::LoadFrom((Join-Path $ToolsPath EntityF ... + ~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand 您不能在空值表达式上调用方法。在 D:\Dev\Project\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:781 字符:5 + $dispatcher = $utilityAssembly.CreateInstance( + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId:InvokeMethodOnNull Join-Path:无法将参数绑定到参数“路径”,因为它为空。在 D:\Dev\Project\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:810 字符:20 +(加入路径 $runner.ToolsPath EntityFramework.PowerShell.dll), + ~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
大多数情况下,重新启动 Visual Studio 2015 会解决此问题,但有时我必须通过从 C:\Users{UserName}\AppData\Local\Microsoft\VisualStudio\14.0 中删除所有项目来手动清除组件缓存\ComponentModelCache
我确实以管理员身份运行 VS2015。
【问题讨论】:
-
这可能是一个已知的错误connect.microsoft.com/VisualStudio/feedback/details/1663079/…。我建议您使用新版本 Update 1 ISO 重新安装 Visual Studio。清理所有临时文件并“强制卸载”。
-
谢谢,我会试试的。如果我从 visualstudio.com 下载 Visual Studio 社区,是否可以获得更新 1 ISO?
-
我不确定,这里有下载链接,试试visualstudio.com/en-us/news/vs2015-update1-vs.aspx
-
我打算建议你检查更新。
-
你有没有遇到过这个问题?
标签: visual-studio-2015 entity-framework-6 entity-framework-migrations