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.
The HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0\Profile\AutoSaveFile
parameter contains the %vsspv_visualstudio_dir%\settings\CurrentSettings.vssettings
value.
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
A other problem and his solution. This post was the tipp for to solution - thanks.
The variable
%vsspv_visualstudio_dir%
is associated by default with the default directory "Documents".Problem: If the default directory "Documents" does not exists (because it was removed via registry, wasn't a good idea), so the settings are not accepted or saved in MS VS Setting, Projects and Solutions, Locations. Next new start of MS VS lost this setting.
Solution: Restore default directory "Documents".
Test: MS VS reseting section "General" to default setting without fault.
It was a long way to find out why the MS VS Setting is not saved.
The locations of project and item templates folder for current VS2015 user profile can also be found in the following registry keys:
Those values do not contain any variables and so can be used as is.