Extension Analyzer
The Extension Analyzer captures and logs most common extension load failures. The Extension Analyzer runs in its own tool window. The analyzer reports the reason for a failure and suggestions about how to fix it.
The Extension Analyzer can be downloaded from the Visual Studio Gallery. The Extension Analyzer assemblies are installed in <Visual Studio installation path>\Common7\IDE\PrivateAssemblies\.
Browser
After you have installed the Extension Analyzer, on the Tools menu click Extension Analyzer, then Browser. A window is displayed that lists all the extensions that are registered on the computer. There are different tabs for VSIX files, VSPackages, PkgDef files, and MEF components. You can sort the lists by any of the column names.
The VSIX tab displays information about installed VSIX extensions. You can include system components by selecting the Show System Components checkbox. On this tab, you can navigate to log entries for the VSIX, open the VSIX manifest in Visual Studio XML editor, and open the folder where the VSIX extension is installed.
The VS Packages tab displays information about VSPackages that are currently known to Visual Studio, whether or not they are loaded. This information includes the VSIX identifier, the .pkgdef file, and the GUID of the VSPackage. You can include system VSPackages by selecting the Show System Packages checkbox. On this tab, you can navigate to log entries, see the VSIX listed on the VSIX tab, see the .pkgdef file on the PkgDef Files tab, and analyze the VSPackage. The results of the analysis are shown in the Output pane.
The PkgDef Files tab displays information about the .pkgdef files for extensions known to Visual Studio. This information includes the VSIX identifier, and the path of the extension. You can navigate to the log or to the VSIX tab, and you can view the .pkgdef file in the editor.
The MEF Components tab displays information about MEF components that are known to Visual Studio. This information includes the VSIX identifier and the path where the extension is installed. You can include system components by selecting the Show System Components checkbox. You can also navigate to the corresponding VSIX entry, the .pkgdef file, and the location where the extension was installed.
警告
You may receive a message asking you to turn on Fusion logging. To do so, select a location for the log files. You may be asked to restart all instances of Visual Studio before continuing.
Log Viewer
You can see logging messages with the Extension Log Viewer if you are running a project that has logging turned on (by adding /log to the command line arguments of your project). For more information, see /Log (devenv.exe). The Extension Log Viewer window displays the date, the listener, the entry type (type of message), the error type, class/interface information, and the log message. You can sort and filter the information.
Common Extension Loading Issues
Some of the typical reasons for an extension load failure in Visual Studio are:
Dependency issues. An extension may have been deployed in such a way that dependent assemblies cannot be found.
Exceptions. When a VSPackage is loaded, Visual Studio calls its SetSite method. If this method throws an exception, then the VSPackage load fails. The best way to isolate this issue is to step through the SetSite code.
Improper registration. Verify that the extension is signed appropriately and that the VSPackage is registered by using the correct public key.