none
How can I get the value of %vsspv_visualstudio_dir% variable?

    Question

  • VS2015 Update 3

    In my external application I need to get the User project templates location and User item templates location settings values for VS2015. Then I will add my templates into that directories.

    enter image description here

    The HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0\Profile\AutoSaveFile parameter contains the %vsspv_visualstudio_dir%\settings\CurrentSettings.vssettings value.

    enter image description here

    Inside of that file the necessary values also contains the %vsspv_visualstudio_dir% variable:

    <PropertyValue name="ProjectTemplatesLocation">%vsspv_visualstudio_dir%\Templates\ProjectTemplates</PropertyValue>  
    <PropertyValue name="ProjectItemTemplatesLocation">%vsspv_visualstudio_dir%\Templates\ItemTemplates</PropertyValue>

    How can I expand the %vsspv_visualstudio_dir% variable? The Environment.ExpandEnvironmentVariables(String) method can't expand it:

    var str = Environment.ExpandEnvironmentVariables(
        "%vsspv_visualstudio_dir%"); // I get the same string
    Sunday, February 12, 2017 5:01 PM

Answers

  • Why don't you read the following entries?

    Key: HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0

    Names: 

    - UserItemTemplatesLocation

    - UserProjectTemplatesLocation

    Both can have values that start with:

    %USERPROFILE%\Documents\Visual Studio 2015\Templates\

    but %USERPROFILE% is much easier to expand.


    My portal and blog about VSX: http://www.visualstudioextensibility.com<br/> Twitter: https://twitter.com/VSExtensibility<br/> MZ-Tools productivity extension for Visual Studio: https://www.mztools.com

    Sunday, February 12, 2017 6:04 PM