Visual Studio 2017在哪里存储其配置? [英] Where does Visual Studio 2017 store its config?

查看:345
本文介绍了Visual Studio 2017在哪里存储其配置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在VS 2015及更早版本中,设置存储在注册表中,例如HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0_Config.根据

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.

根据此SO答案.现在我想在VS 2017中做同样的事情,但是找不到设置的存储位置来进行更改.

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.

Visual Studio 2017的这些设置存储在哪里?

Where are these settings stored for Visual Studio 2017?

推荐答案

我在

查看我的计算机上的常规HKEY_CURRENT_USER \ Software \ Microsoft \ VisualStudio \ 15.0密钥有多空,请注意没有15.0_Config密钥:

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:

相反,VS 2017私有注册表存储在您的AppData文件夹中:

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

幸运的是,您可以使用regedit.exe加载私有配置单元.您需要选择HKEY_USERS节点,然后单击File> Load Hive…菜单.您选择privateregistry.bin文件,为配置单元命名(我输入"VS2017PrivateRegistry"),现在您可以像往常一样填充15.0_Config键(注意:完成后使用File> Unload Hive):

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):

使用本指南,我能够加载私有注册表,并从前面提到的SO答案中进行更改,卸载配置单元,以黑暗主题启动VS 2017!

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!

编辑:我不得不稍稍修改用于编辑注册表的PowerShell脚本,如果有人感兴趣,这是更新的版本:

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 :现在进行了修改,以自动包含私有注册表的加载,包括一个允许卸载配置单元的垃圾收集器:

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

注意:您必须找到用户名(C:\Users\Geir)和VS版本(15.0_8165452c)的正确路径.

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'

这篇关于Visual Studio 2017在哪里存储其配置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆