Where does Visual Studio 2017 store its config?

18,839

Solution 1

I found the answer in this blog post:

See how empty is the regular HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\15.0 key on my machine and notice that there is no 15.0_Config key:

Regedit

Instead, the VS 2017 private registry is stored in your AppData folder:

AppData

Fortunately, you can use regedit.exe to load a private hive. You need to select the HKEY_USERS node, and click the File > Load Hive… menu. You select the privateregistry.bin file, give a name to the hive (I entered “VS2017PrivateRegistry”) and now you can see the 15.0_Config key populated as usual (note: use File > Unload Hive when done):

Private registry

Using this guide, I was able to load the private registry, do the changes from the SO answer mentioned earlier, unload the hive and start VS 2017 with the Dark Theme!

EDIT: I had to slightly modify the PowerShell script I used to edit the registry, here is the updated version if anyone is interested:

EDIT2: Now modified to include the loading of the private registry automatically as well, including a garbace collection to allow unloading the hive:

NOTE: You have to find your own correct path for the user name (C:\Users\Geir) and VS version (15.0_8165452c).

New-PSDrive HKU Registry HKEY_USERS

reg load 'HKU\VS2017PrivateRegistry\' "C:\Users\Geir\AppData\Local\Microsoft\VisualStudio\15.0_8165452c\privateregistry.bin"

$HighConstrastTheme = "HKU:\VS2017PrivateRegistry\Software\Microsoft\VisualStudio\15.0_8165452c_Config\Themes\{a5c004b4-2d4b-494e-bf01-45fc492522c7}"
$DarkTheme = "HKU:\VS2017PrivateRegistry\Software\Microsoft\VisualStudio\15.0_8165452c_Config\Themes\{1ded0138-47ce-435e-84ef-9ec1f439b749}"

Remove-Item -Path $HighConstrastTheme -Recurse
Copy-Item -Path $DarkTheme -Destination $HighConstrastTheme -Recurse

[gc]::collect()

reg unload 'HKU\VS2017PrivateRegistry'

Solution 2

I've implemented a batch-file-based approach that does everything automatically and also backs up the high contrast theme in case you need to restore it for any reason.

You can find it at https://randomshaper.blogspot.com.es/2017/06/visual-studio-2017-high-contrast-hack.html

Solution 3

The following VS2017PrivateRegistry.cmd batch file loads registry keys for all Visual Studio 2017 instances as HKLM_TMPVS_[id], starts Registry Editor for you to make changes in Visual Studio settings and unloads keys when you close Registry Editor:

for /d %%f in (%LOCALAPPDATA%\Microsoft\VisualStudio\15.0_*) do reg load HKLM\_TMPVS_%%~nxf "%%f\privateregistry.bin"
regedit
for /d %%f in (%LOCALAPPDATA%\Microsoft\VisualStudio\15.0_*) do reg unload HKLM\_TMPVS_%%~nxf

Note: first close running Visual Studio 2017 instances with background processes and then run this file with administrator rights.

See Changing Visual Studio 2017 private registry settings for more details.

Share:
18,839
Geir Sagberg
Author by

Geir Sagberg

System developer at Bekk Consulting

Updated on June 06, 2022

Comments

  • Geir Sagberg
    Geir Sagberg almost 2 years

    In VS 2015 and earlier, settings were stored in the registry, e.g. HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0_Config. In VS 2017, to support multiple instances of VS, the settings were moved out of the registry, according to this post.

    I have previously been editing the registry to force Dark Theme when Windows is in High Contrast mode, according to this SO answer. Now I want to do the same in VS 2017 but cannot find where the settings are stored, to make this change.

    Where are these settings stored for Visual Studio 2017?

  • Geir Sagberg
    Geir Sagberg over 7 years
    Interesting, not sure why it's looking there as well as in its private registries (see my answer). I won't be pursuing this further as I have found a solution though.
  • Jacob de Boer
    Jacob de Boer about 7 years
    Hi there. Thank you for your powershell script. Only the file paths and registry path do not seem to work in all cases. I use the release version of Visual Studio 2017 and the path of the private registry and the path of theme settings in the registry. In order to make this work I had to change the script like this:
  • Geir Sagberg
    Geir Sagberg about 7 years
    @jacobdeboer Yes, the paths might be slightly different for your case. I will add a note about this.
  • Shiv
    Shiv almost 7 years
    Is loading these hives and editing them programmatically possible? The C# Win32 registry class does not appear to support this unless I am mistaken?
  • ccalboni
    ccalboni over 6 years
    Remember to unload the hive otherwise VS won't start
  • T.S
    T.S over 6 years
    A bit of a hassle,. wondering why they can't just add "search result format" to the regular settings.? anyhow - blogs.msdn.microsoft.com/zainnab/2010/01/03/… : explains what each setting does for the search results format.
  • Top Cat
    Top Cat about 6 years
    I honestly don't understand why Microsoft don't let us pick a theme when we are in high contrast mode.