Various Visual Studio profiles and installing extensions to them

    Creating and running environments

    In most cases, developers do not need to use Visual Studio in the sandbox. At the same time, the sandbox can be quite large and stable. Usually all the environment and additions to the studio are in a single copy. The fact that the studio is launched in several instances does not count. The environment and settings for them are the same.

    However, there are a number of tasks when you want to get a "studio that seems to have just been installed." What are these tasks?
    • Testing add-ons for Visual Studio. You can do reviews on add-ons, or want to see the stability of an add-on without installing it in your working studio copy.
    • Add-on development for Visual Studio. In this case, it is still more dangerous for development, since an addition with errors can permanently disable the studio. But in this case, you will be safe, as for debug studio will be launched in the sandbox.
    • Work with very different settings for multiple projects. This can be various plugins, window settings, hotkeys and in general everything that can be configured in the studio.

    I needed this in light of testing the add-on to the studio, which must be installed on separate environments / profiles. Some details about the specifics of the task: There is a framework that is delivered as a VSIX package. The nuance is that the framework is simultaneously developed \ supported for several number versions that cannot coexist in parallel within the same Visual Studio profile.

    The solution to this situation would be to use Visual Studio Hives. Using this technology \ approach, a situation arises as if you had several independent instances of Visual Studio installed in parallel. Each such instance will be named. Actually, by name you will contact him in the future.

    Creating a new studio profile is very simple and is done in one line. The same line launches the created named Visual Studio profile.

    % PATH_TO_VS% \ devenv.exe / rootsuffix% NAME%

    For example, you can create an instance called Test. Then it will look something like this:

    “C: \ Program Files (x86) \ Microsoft Visual Studio 12.0 \ Common7 \ IDE \ devenv.exe” / rootsuffix Test

    Creating a new named environment takes some time and at the first start you will see the studio preparation process at the first start. After which you will have VS without a history of projects, without additions. Actually a clean studio. In order to start the newly created environment, you must use the same command line.

    “C: \ Program Files (x86) \ Microsoft Visual Studio 12.0 \ Common7 \ IDE \ devenv.exe” / rootsuffix Test

    All environment settings will be contained in the folder. You can directly enter:

    % LOCALAPPDATA% \ Microsoft \ VisualStudio

    And also in the registry branch

    HKCU \ Software \ Microsoft \ VisualStudio \ 12.0ProfileName

    On my home system there are 2 additional environments besides the "default". It:


    • 12.0 - default environment
    • Exp - custom
    • Roslyn - Custom

    Install extensions

    We could stop here, but there is a problem that could negate all the advantages of independent environments. This problem: Inability to specify in which environment to install the VSIX package.

    I mean, there is no official way for third-party packages. In those that you are developing, configuration files will be tweaked to run in another profile. Studio extension packs do not have any keys that can help install the extension in a specific named environment. During the installation, there is also no choice of environment. You will not be able to install the extension by dragging it into the studio window. By default, everything is installed in the main instance of the studio.

    To solve this problem, I found a small command-line tool that allows you to install VSIX in the desired Visual Studio profile. You can download it ready-made or in the form of a code .
    Using the tool is quite simple. Run the command line, specify the path to the tool, specify the studio version, profile name, path to the vsix package:

    Root-VSIX []

    For example:

    C: \ Tools \ Root-VSIX.exe 12.0 Test c: \ VS12 \ Extensions \ SomeExtension.vsix

    Everything is ready!

    Identification of a running profile may be some problem, since its name is not displayed anywhere in a running studio. You can distinguish along the way from the TaskManager or try to find or write an extension for the studio;)

    Also popular now: