Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Component Cache Out of Date

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.

like image 444
jao Avatar asked Dec 04 '22 01:12

jao


1 Answers

You should go to

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

and delete the ComponentModelChache directory.

like image 166
Luis Lezcano Airaldi Avatar answered Jan 11 '23 15:01

Luis Lezcano Airaldi