Failed to install Visual studio extensions .VSIX

2020-07-22 19:43发布

问题:

I'm facing an error while trying to install/update any visual studio extension, I'm running Visual studio 2015 enterprise edition on Windows 7.

12/12/2016 11:35:11 AM - Microsoft VSIX Installer
12/12/2016 11:35:11 AM - -------------------------------------------
12/12/2016 11:35:11 AM - Initializing Install...
12/12/2016 11:35:11 AM - Extension Details...
12/12/2016 11:35:11 AM -    Identifier         : EntityFramework_Reverse_POCO_Generator..d542a934-8bd6-4136-b490-5f0049d62033
12/12/2016 11:35:11 AM -    Name               : EntityFramework Reverse POCO Generator
12/12/2016 11:35:11 AM -    Author             : Simon Hughes
12/12/2016 11:35:11 AM -    Version            : 2.25.0
12/12/2016 11:35:11 AM -    Description        : Reverse engineers an existing database and generates EntityFramework Code First POCO classes, Configuration mappings and DbContext.
12/12/2016 11:35:11 AM -    Locale             : en-US
12/12/2016 11:35:11 AM -    MoreInfoURL        : https://efreversepoco.codeplex.com/
12/12/2016 11:35:11 AM -    InstalledByMSI     : False
12/12/2016 11:35:11 AM -    SupportedFrameworkVersionRange : [4.5,)
12/12/2016 11:35:11 AM - 
12/12/2016 11:35:11 AM -    SignatureState     : Unsigned
12/12/2016 11:35:11 AM -    References         : 
12/12/2016 11:35:11 AM - Signature Details...
12/12/2016 11:35:11 AM -    Extension is not signed.
12/12/2016 11:35:11 AM - 
12/12/2016 11:35:11 AM - Searching for applicable products...
12/12/2016 11:35:13 AM - Found installed product - Microsoft Visual Studio Enterprise 2015
12/12/2016 11:36:48 AM - The extension will be upgraded from version 2.24.0.
12/12/2016 11:36:48 AM - Found installed product - Microsoft Visual Studio Professional 2015
12/12/2016 11:36:48 AM - Found installed product - Microsoft Visual Studio Community 2015
12/12/2016 11:36:48 AM - Found installed product - Microsoft Visual Studio 2015 Shell (Integrated)
12/12/2016 11:36:48 AM - Found installed product - Global Location
12/12/2016 11:36:48 AM - Found installed product - ssms
12/12/2016 11:37:57 AM - The following target products have been selected...
12/12/2016 11:37:57 AM -    Microsoft Visual Studio Enterprise 2015
12/12/2016 11:37:57 AM - 
12/12/2016 11:37:57 AM - Beginning to install extension to Microsoft Visual Studio Enterprise 2015...
12/12/2016 11:37:57 AM - Upgrading 'EntityFramework Reverse POCO Generator', version 2.24.0 to version 2.25.0.
12/12/2016 11:37:59 AM - Install Error : System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.VisualStudio.ExtensionManager.ExtensionManagerService.RemoveExtensionAutoUpdateSetting(String extensionIdentifier)
   at Microsoft.VisualStudio.ExtensionManager.ExtensionManagerService.UninstallInternal(IInstalledExtension extension, Boolean forceDelete)
   at Microsoft.VisualStudio.ExtensionManager.ExtensionManagerService.CommitInstalledAndUninstalledExtensions(IEnumerable`1 installedExtensions, IEnumerable`1 uninstalledExtensions, IEnumerable`1 packComponentChanges)
   at Microsoft.VisualStudio.ExtensionManager.ExtensionManagerService.BeginInstall(IInstallableExtension installableExtension, Boolean perMachine, AsyncOperation asyncOp, Boolean enforceCertificateCheckForUpgrade)
   at Microsoft.VisualStudio.ExtensionManager.ExtensionManagerService.InstallWorker(IInstallableExtension extension, Boolean perMachine, AsyncOperation asyncOp, Boolean enforceCertificateCheckForUpgrade)
12/12/2016 11:37:59 AM - Reverting uninstall of version 2.24.0 of the extension.

Any advice????

回答1:

Do you have a file called MachineState.json in your <VS2015 Install Dir>/Common7/IDE/Extensions/ folder? If you do, try renaming it or deleting it.

Taking a look inside the Microsoft.VisualStudio.ExtensionManager.Implementation.dll assembly, in the function that's throwing the System.NullReferenceException, it looks looks like this:

private static void RemoveExtensionAutoUpdateSetting(string extensionIdentifier)
{
    AutoUpdateMachineSettings current = AutoUpdateMachineSettings.Current;
    if (current.Extensions.Keys.Contains<string>(extensionIdentifier))
    {
        current.Extensions.Remove(extensionIdentifier);
        AutoUpdateMachineSettings.Current = current;
    }
}

The AutoUpdateMachineSettings.Current field getter attempts to deserialize that JSON file, and I'm not sure how that works internally, but if it returns null when it fails, that could result in this exception.

The other possibility is that the input extensionIdentifier argument is null, which implies that the structure containing the extension's header information contains a null extension Identifier. The only way I could see this happening is if the on-disk extension cache became corrupt or broke or something, somehow. The cache files live in <User Dir>/AppData/Local/Microsoft/VisualStudio/14.0/Extensions/ and are the extensions.<locale>.cache and extensionSdks.<locale>.cache files. Try removing or renaming those files, and attempt the update again. They're cache files, so I'd assume that they'll safely be rebuilt when VS realizes they don't exist, and from what I can tell from a quick look at the code it seems that they just contain a bunch of binary metadata about the installed extensions.

If none of that works, perhaps you could attach a debugger to the installer, and then provide more information about the exception that's being thrown?



回答2:

For me , I copied the packages to local machine's folder --> give file sharing access to everyone --> click ok --> then install the package.