Visual Studio 组件缓存过期 [英] Visual Studio Component Cache Out of Date

查看:32
本文介绍了Visual Studio 组件缓存过期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Almost every time I try to run the update-database command for EF migrations, I get the following error in Visual Studio 2015:

使用1"个参数调用GetService"的异常:异常使用2"个参数调用Invoke":Visual Studio 组件缓存已过期.请重新启动 Visual Studio.视觉工作室组件缓存已过期.请重新启动 Visual Studio."" 在D:DevProjectpackagesEntityFramework.6.1.3 oolsEntityFramework.psm1:1004字符:5+ $packageInstallerServices = $componentModel.GetService([NuGet.Vis ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException+ FullyQualifiedErrorId : ScriptMethodRuntimeException 您不能在空值表达式上调用方法.在D:DevProjectpackagesEntityFramework.6.1.3 oolsEntityFramework.psm1:1006字符:5+ $vsPackage = $packageInstallerServices.GetInstalledPackages() |?...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidOperation: (:) [], RuntimeException+ FullyQualifiedErrorId:InvokeMethodOnNull Join-Path:无法将参数绑定到参数路径",因为它为空.在D:DevProjectpackagesEntityFramework.6.1.3 oolsEntityFramework.psm1:713字符:28+ $toolsPath = 加入路径 $installPath 工具+~~~~~~~~~~~~+ CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand加入路径:无法将参数绑定到参数路径",因为它是空值.在D:DevProjectpackagesEntityFramework.6.1.3 oolsEntityFramework.psm1:780字符:74+ ... [System.Reflection.Assembly]::LoadFrom((Join-Path $ToolsPath EntityF ...+ ~~~~~~~~~~+ CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand您不能在空值表达式上调用方法.在D:DevProjectpackagesEntityFramework.6.1.3 oolsEntityFramework.psm1:781字符:5+ $dispatcher = $utilityAssembly.CreateInstance(+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidOperation: (:) [], RuntimeException+ FullyQualifiedErrorId:InvokeMethodOnNull Join-Path:无法将参数绑定到参数路径",因为它为空.在D:DevProjectpackagesEntityFramework.6.1.3 oolsEntityFramework.psm1:810字符:20+(加入路径 $runner.ToolsPath EntityFramework.PowerShell.dll),+ ~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand

Exception calling "GetService" with "1" argument(s): "Exception calling "Invoke" with "2" argument(s): "The Visual Studio component cache is out of date. Please restart Visual Studio. The Visual Studio component cache is out of date. Please restart Visual Studio."" At D:DevProjectpackagesEntityFramework.6.1.3 oolsEntityFramework.psm1:1004 char:5 + $packageInstallerServices = $componentModel.GetService([NuGet.Vis ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : ScriptMethodRuntimeException You cannot call a method on a null-valued expression. At D:DevProjectpackagesEntityFramework.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:DevProjectpackagesEntityFramework.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:DevProjectpackagesEntityFramework.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:DevProjectpackagesEntityFramework.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:DevProjectpackagesEntityFramework.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

  • 大多数时候重启 Visual Studio 2015 会解决这个问题,但有时我必须通过从 C:Users{UserName}AppDataLocalMicrosoftVisualStudio14.0 中删除所有项目来手动清除组件缓存ComponentModelCache

    • Most of the time restarting Visual Studio 2015 will fix this, but sometimes I have to clear the component cache manually by removing all items from C:Users{UserName}AppDataLocalMicrosoftVisualStudio14.0ComponentModelCache

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

      I do run VS2015 as administrator.

      推荐答案

      你应该去

      %APPDATA%LocalMicrosoftVisual Studio<version>
      

      并删除 ComponentModelChache 目录.

      and delete the ComponentModelChache directory.

      这篇关于Visual Studio 组件缓存过期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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