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

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

问题描述

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


异常调用GetService与1参数:异常
调用调用与2参数:Visual Studio组件
缓存已过期。请重新启动Visual Studio。 Visual Studio
组件缓存已过期。请重新启动Visual Studio。
D:\Dev\Project\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:1004
char:5
+ $ packageInstallerServices = $ componentModel.GetService([NuGet.Vis ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ],MethodInvocationException
+ FullyQualifiedErrorId:ScriptMethodRuntimeException您无法调用空值表达式的方法。
D:\Dev\Project\packages\EntityFramework.6.1.3\tools\\ \\EntityFramework.psm1:1006
char:5
+ $ vsPackage = $ packageInstallerServices.GetInstalledPackages()|?...
+ ~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~
+ CategoryInfo:InvalidOperation:(:) [],RuntimeException
+ FullyQualifiedErrorId:InvokeMethodOnNull Join-Path:无法绑定参数参数'Path',因为它为空。在
D:\Dev\Project\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:713
char:28
+ $ toolsPath = Join-Path $ installPath工具
+ ~~~~~~~~~~~~~
+ CategoryInfo:InvalidData:(:) [Join-Path],ParameterBindingValidationException
+ FullyQualifiedErrorId:ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
Join-Path:无法将参数绑定到参数Path,因为它是
null。在
D:\Dev\Project\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:780
char:74
+ ... [系统.Reflection.Assembly] :: LoadFrom((Join-Path $ ToolsPath EntityF ...
+ ~~~~~~~~~~
+ CategoryInfo:InvalidData:(:) [Join-Path ],ParameterBindingValidationException
+ FullyQualifiedErrorId:ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
您不能调用空值表达式的方法
D:\Dev\Project\ package\EntityFramework.6.1.3\tools\EntityFramework.psm1:781
char:5
+ $ dispatcher = $ utilityAssembly.CreateInstance(
+ ~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ )[],RuntimeException
+ FullyQualifiedErrorId:InvokeMethodOnNull连接路径:无法绑定参数Path,因为它为null。在
D:\Dev\Project\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:810
char:20
+(Join-Path $ $。
+ ~~~~~~~~~~~~~~~~~~
+类别信息:InvalidData:(:) [Join-Path] ParameterBindingValidationException
+ FullyQualifiedErrorId:ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand





  • 大部分时间重新启动Visual Studio 2015将修复此问题,但有时我必须通过从C:\Users {UserName} \AppData\Local\Microsoft\VisualStudio\14.0中删除所有项来手动清除组件缓存。 \ComponentModelCache


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



解决方案

你应该去

 %APPDATA%\Local\Microsoft\Visual Studio\< version> 

并删除ComponentModelChache目录。


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

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:\Dev\Project\packages\EntityFramework.6.1.3\tools\EntityFramework.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:\Dev\Project\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:\Dev\Project\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:\Dev\Project\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:\Dev\Project\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:\Dev\Project\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

  • 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}\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache

  • I do run VS2015 as administrator.

解决方案

You should go to

%APPDATA%\Local\Microsoft\Visual Studio\<version>

and delete the ComponentModelChache directory.

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

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