本文介绍了无法安装 Visual Studio 扩展 .VSIX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试安装/更新任何 Visual Studio 扩展时遇到错误,我在 Windows 7 上运行 Visual Studio 2015 企业版.

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.

有什么建议吗????

推荐答案

你的 /Common7/IDE/Extensions 中是否有名为 MachineState.json 的文件/ 文件夹?如果这样做,请尝试重命名或删除它.

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.

查看 Microsoft.VisualStudio.ExtensionManager.Implementation.dll 程序集内部,在抛出 System.NullReferenceException 的函数中,它看起来像这样:

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;
    }
}

AutoUpdateMachineSettings.Current 字段 getter 尝试反序列化该 JSON 文件,我不确定它在内部是如何工作的,但是如果它在失败时返回 null,这可能会导致此异常.

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.

另一种可能是输入extensionIdentifier参数为空,这意味着包含扩展头信息的结构包含一个空扩展Identifier.我能看到这种情况发生的唯一方法是磁盘扩展缓存是否以某种方式损坏或损坏或其他原因.缓存文件位于 /AppData/Local/Microsoft/VisualStudio/14.0/Extensions/ 并且是 extensions..cacheextensionSdks..cache 文件.尝试删除或重命名这些文件,然后再次尝试更新.它们是缓存文件,所以我假设当 VS 意识到它们不存在时,它们会安全地重建,并且从我快速查看代码可以看出它们似乎只包含一堆二进制文件有关已安装扩展程序的元数据.

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?

这篇关于无法安装 Visual Studio 扩展 .VSIX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 19:44