Changes in Visual Studio 2017 extensibility

With Visual Studio 2017, we’re offering a faster, lighter-weight Visual Studio installation experience that reduces the impact of Visual Studio on user systems, while giving users greater choice over the workloads and features that are installed. To support these improvements, we’ve made changes to the extensibility model, and have made some breaking changes to Visual Studio extensibility. This document will describe the technical details of these changes, and what can be done to address them. Please note that some information is point-in-time implementation details and may be changed later.

Changes Affecting VSIX Format and Installation

We’re introducing the VSIX v3 (version 3) format to support the light-weight installation experience.

Changes to the VSIX format include:

  • Declaration of setup prerequisites. To deliver on the promise of a lightweight, fast-installing Visual Studio, the installer now offers more configuration options to users. As a result, to ensure that the features and components required by an extension are installed, extensions will need to declare their dependencies.
    • The Visual Studio 2017 installer will automatically offer to acquire and install the necessary components for the user as part of installing your extension.
    • Users will also be warned when trying to install an extension that was not built using the new VSIX v3 format, even if they have been marked in their manifest as targeting version 15.0.
  • Enhanced capabilities for the VSIX format. To deliver on a low-impact install of Visual Studio that also supports side-by-side installs, we no longer save most configuration data to the system registry and have moved Visual Studio-specific assemblies out of the GAC. We also increased the capabilities of the VSIX format and VSIX installation engine, allowing you to use it rather than an MSI or EXE to install your extensions for some installation types.

    The new capabilities include:

    • Registration into the specified Visual Studio instance.
    • Installation outside the extensions folder.
    • Detection of processor architecture.
    • Dependence on language-separated language packs.
    • Installation with NGEN support.

Building an extension for Visual Studio 2017

Designer tooling for authoring of the new VSIX v3 manifest format is now available in Visual Studio 2017. See the accompanying document How to: Migrate Extensibility Projects to Visual Studio 2017 for details on using the designer tools or making manual updates to the project and manifest to develop VSIX v3 extensions.

Change: Visual Studio user data path

Previously, only one installation of each major release of Visual Studio could exist on each machine. To support side-by-side installations of Visual Studio 2017, multiple user data paths for Visual Studio may exist on the user’s machine.

Code running inside the Visual Studio process should be updated to use the Visual Studio Settings Manager. Code running outside of the Visual Studio process can find the user path of a specific Visual Studio installation by following the guidance here.

Change: Global Assembly Cache (GAC)

Most Visual Studio core assemblies are no longer installed into the GAC. The following changes were made so that code running in Visual Studio process can still find required assemblies at runtime.

  • Assemblies that were only installed into the GAC:
    • These assemblies are now installed under %VsFolder%\Common7\IDE\, %VsFolder%\Common7\IDE\PublicAssemblies or %VsFolder%\Common7\IDE\PrivateAssemblies. These folders are part of the Visual Studio process’s probing paths.
  • Assemblies that were installed into a non-probing path and into the GAC:

    • The copy in the GAC was removed from setup.
    • A .pkgdef file was added to specify a code base entry for the assembly.

      For example:

      "name"="AssemblyName" "codeBase"="$PackageFolder$\AssemblyName.dll"
      "publicKeyToken"="Public Key Token"

      At runtime, the Visual Studio pkgdef subsystem will merge these entries into the Visual Studio process’s runtime configuration file (under %VsAppDataFolder%\devenv.exe.config) as <codeBase> elements. This is the recommended way to let the Visual Studio process find your assembly, because it avoids searching through probing paths.

Reacting to this breaking change

  • If your extension is running within the Visual Studio process:
    • Your code will be able to find Visual Studio core assemblies.
    • Consider using a .pkgdef file to specify a path to your assemblies if necessary.
  • If your extension is running outside the Visual Studio process:
    • Consider looking for Visual Studio core assemblies under %VsFolder%\Common7\IDE\, %VsFolder%\Common7\IDE\PublicAssemblies or %VsFolder%\Common7\IDE\PrivateAssemblies using configuration file or assembly resolver.

Change: Reduce registry impact

Global COM registration

  • Previously, Visual Studio installed many registry keys into the HKEY_CLASSES_ROOT and HKEY_LOCAL_MACHINE hives to support native COM registration. To eliminate this impact, Visual Studio now uses Registration-Free Activation for COM components.
  • As a result, most TLB / OLB / DLL files under %ProgramFiles(x86)%\Common Files\Microsoft Shared\MSEnv are no longer installed by default by Visual Studio. These files are now installed under %VsFolder% with corresponding Registration-Free COM manifests used by the Visual Studio host process.
  • As a result, external code that relies on global COM registration for Visual Studio COM interfaces will no longer find these registrations. Code running inside Visual Studio process will not see a difference.

Visual Studio registry

  • Previously, Visual Studio installed many registry keys into the system’s HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER hives under a Visual Studio-specific key:
    • HKLM\Software\Microsoft\VisualStudio\Version: Registry keys created by MSI installers and per-machine extensions.
    • HKCU\Software\Microsoft\VisualStudio\Version: Registry keys created by Visual Studio to store user-specific settings.
    • HKCU\Software\Microsoft\VisualStudio\Version_Config: A copy of Visual Studio HKLM key above, plus the registry keys merged from .pkgdef files by extensions.
  • To reduce the impact on the registry, Visual Studio now uses the RegLoadAppKey function to store registry keys in a private binary file under %VsAppDataFolder%\privateregistry.bin. Only a very small number of Visual Studio-specific keys remain in the system registry.
  • Existing code running inside the Visual Studio process is not impacted. Visual Studio will redirect all registry operations under the HKCU Visual Studio-specific key to the private registry. Reading and writing to other registry locations will continue to use the system registry.
  • External code will need to load and read from this file for Visual Studio registry entries.

Reacting to this breaking change

  • External code should be converted to use Registration-Free activation for COM components as well.
  • External components can find the Visual Studio location by following the guidance here.
  • We recommend that external components use the External Settings Manager instead of reading/writing directly to Visual Studio registry keys.
  • Check whether the components your extension is using may have implemented another technique for registration. For example, debugger extensions may be able to take advantage of the new msvsmon JSON-file COM registration.

Change: Lightweight Solution Load

Lightweight Solution Load (LSL) reduces Solution load time by not fully loading projects until the user starts working with them. This may effect extensions which assume a project is completely loaded. See Lightweight Solution Load to learn whether your extension may be impacted and get guidance on updating your extension.