Visual Studio Component Cache Out of Date

2019-02-18 03:40发布

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.

2条回答
疯言疯语
2楼-- · 2019-02-18 03:58

You should go to

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

and delete the ComponentModelChache directory.

查看更多
狗以群分
3楼-- · 2019-02-18 04:11

I was getting this error when trying to select records in my SQL server management studio:

Error: "The Visual Studio component cache is out of date. Please restart Visual Studio. (Microsoft.VisualStudio.ExtensibilityHosting)"

I restarted Visual Studio but got same error.

Solution: I went to this location: "C:\Users\username\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache"

And deleted all the files inside that folder and restarted both VS and SQL server. IT WORKED!

查看更多
登录 后发表回答