Where does Visual Studio 2017 store its config?
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:
Instead, the VS 2017 private registry is stored in your AppData folder:
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):
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'
Programmatically finding the VS2017 Most Recently Used (MRU) solutions and projects
The recommended way to access VS 2017 settings is to use the External Settings Manager:
ExternalSettingsManager ext = ExternalSettingsManager.CreateForApplication(@"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\devenv.exe");
SettingsStore store = ext.GetReadOnlySettingsStore(SettingsScope.UserSettings);
foreach (string name in store.GetPropertyNames(@"MRUItems\{a9c4a31f-f9cb-47a9-abc0-49ce82d0b3ac}\Items"))
{
string value = store.GetString(@"MRUItems\{a9c4a31f-f9cb-47a9-abc0-49ce82d0b3ac}\Items", name);
Console.WriteLine("Property name: {0}, value: {1}", name, value);
}
To use the External Settings Manager you need to add a reference to Microsoft.VisualStudio.Settings.15.0.dll to your project.
Can't find Register Entries for Visual Studio Experimental Instance
Visual Studio now uses a private registry, which can be found at
%localappdata%\Microsoft\VisualStudio\15.0_INSTANCE_IDExp\privateregistry.bin
(Replace INSTANCE_ID
by the VS instance ID)
It can be loaded in regedit.exe
, but it's not possible to edit the keys from there I think.
Clear custom Look In entries from the Search and Replace dialog
It seem that for Visual Studio 2017, these keys have been moved to an external "hive", which is located under:
%localappdata%\Microsoft\VisualStudio\15.0_6b904c09
(Your Visual Studio version may vary). Look for this file: privateregistry.bin
Basically, we now need to load this into RegEdit before we can access the registry key we are interested in. Here are the complete steps:
- Close Visual Studio.
- Open RegEdit.
- Navigate to
HKEY_USERS
. - Click on : File -> Load Hive... (This will not work if not on
HKEY_USERS
). - Select file
%localappdata%\Microsoft\VisualStudio\15.0_6b904c09\privateregistry.bin
. Your version of Visual Studio may vary. - Select a key name. The hive should then be loaded under that name. I chose "temp" for this example, since this is temporary.
- In RegEdit, navigate to
HKEY_USERS/temp/Software/Microsoft/VisualStudio/15.0_6b904c09/Find/Named
. - Under there, you will find your list of "Find In Files" folder-sets. Delete the ones you don't want.
- When done, move the current selection back to your temporary hive root (loaded in 4).
- Unload it : File -> Unload Hive...
Source : https://developercommunity.visualstudio.com/t/unable-to-delete-from-look-in-list-in-find-in-file/254801
How to change the Find result format in Visual Studio 2017?
VS 2017 now uses private registry (see Where does Visual Studio 2017 RC store its config?). One way to access it directly is from a running Visual Studio 2017 instance with my Visual Commander extension. For example, you can use the following C# command:
public class C : VisualCommanderExt.ICommand
{
public void Run(EnvDTE80.DTE2 DTE, Microsoft.VisualStudio.Shell.Package package)
{
var key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(
@"Software\Microsoft\VisualStudio\" + DTE.Version + @"\Find");
key.SetValue("Find result format", @"$f$e($l): $t\r\n");
}
}
Related Topics
How to Disable Visual Styles for Just One Control, and Not Its Children
Find If Point Lies on Line Segment
Output Console.Writeline from Wpf Windows Applications to Actual Console
Linq: from a List of Type T, Retrieve Only Objects of a Certain Subclass S
Outofmemoryexception on Declaration of Large Array
How to Write a Comment to an Xml File When Using the Xmlserializer
Sortable Jqgrid Using Linq to MySQL (Dblinq) and Dynamic Linq - Orderby Doesn't Work
C# Property and Ref Parameter, Why No Sugar
Moq + Unit Testing - System.Reflection.Targetparametercountexception: Parameter Count Mismatch
How to Apply Indenting Serialization Only to Some Properties
Using Libtiff from C# (To Access Tiled Tiff Images)
How to Use Xpath Function in a Xpathexpression Instance Programatically
C# Parameterized Queries for Oracle - Serious & Dangerous Bug!