Visual Studio 组件缓存已过期



几乎每次我尝试运行 EF 迁移的 update-database 命令时,都会在 Visual Studio 2015 中收到以下错误:

使用"1"参数调用"GetService"的异常:"异常 使用"2"参数调用"调用":"Visual Studio 组件 缓存已过期。请重新启动 Visual Studio。视觉工作室 组件缓存已过期。请重新启动 Visual Studio。在 D:\Dev\Project\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:1004 字符:5 + $packageInstallerServices = $componentModel.GetService([NuGet.Vis ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 类别信息 : 未指定: (:)[], 方法调用异常 + 完全限定错误 ID : 脚本方法运行时异常 不能对空值表达式调用方法。在 D:\Dev\Project\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:1006 字符:5 + $vsPackage = $packageInstallerServices.GetInstalledPackages() | ?... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 类别信息 : 无效操作: (:)[], 运行时异常 + FullQualifiedErrorId : InvokeMethodOnNull Join-Path : 无法将参数绑定到参数 'Path',因为它是 null。在 D:\Dev\Project\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:713 字符:28 + $toolsPath = 连接路径$installPath工具 + ~~~~~~~~~~~~ + 类别信息 : 无效数据: (:)[连接路径], 参数绑定验证异常 + FullQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Command.JoinPathCommand 连接路径:无法将参数绑定到参数"路径",因为它是 零。在 D:\Dev\Project\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:780 字符:74 + ... [System.Reflection.Assembly]::LoadFrom((Join-Path $ToolsPath EntityF ... + ~~~~~~~~~~ + 类别信息 : 无效数据: (:)[连接路径], 参数绑定验证异常 + FullQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Command.JoinPathCommand 不能对 null 值表达式调用方法。在 D:\Dev\Project\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:781 字符:5 + $dispatcher = $utilityAssembly.CreateInstance( + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 类别信息 : 无效操作: (:)[], 运行时异常 + FullQualifiedErrorId : InvokeMethodOnNull Join-Path : 无法将参数绑定到参数 'Path',因为它是 null。在 D:\Dev\Project\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:810 字符:20 +(联接路径$runner。ToolsPath EntityFramework.PowerShell.dll), + ~~~~~~~~~~~~~~~~~ + 类别信息 : 无效数据: (:)[连接路径], 参数绑定验证异常 + FullQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Command.JoinPathCommand

  • 大多数情况下,重新启动Visual Studio 2015可以解决此问题,但有时我必须通过从C:\Users{UserName}\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache中删除所有项目来手动清除组件缓存。

  • 我确实以管理员身份运行VS2015。

你应该去

%APPDATA%LocalMicrosoftVisual Studio<version>

并删除组件模型查切目录。

尝试在 SQL Server 管理工作室中选择记录时出现此错误:

错误:"Visual Studio 组件缓存已过期。请重新启动 Visual Studio。(Microsoft.VisualStudio.ExtensibilityHosting)"

我重新启动了Visual Studio,但遇到了同样的错误。

解决方案:我转到了以下位置:"C:\Users\用户名\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache"

删除了该文件夹中的所有文件,并重新启动了VS和SQL服务器。成功了!

最新更新