How to know which is the current running Visual Studio registry hive.

It’s really useful to know the current registry hive when, for example, when you’re running Visual Studio into the experimental hive even considering, that since Vs 2008 it includes the RANU option (Run as Normal User) with basically means that Visual Studio will loads the information from the HKCU instead of HKLM. You can find more information about that in the Aaron Marten blog.

So, since Vs SDK for Visual Studio 2008 and as a part of MPF we have a VSRegistry helper which tell us in which registry hive the Vs is running, it basically has a static method with a couple of signatures:

image

image

What it does is returns the current running registry key according the type of key, which could be UserSetting, Public Configuration (know as the common registry key, where is located most of the Vs information), etc.

If you’re developing a VSIP package you can also use the ApplicationRegistryRoot property what it basically uses that helper.

3 Comments

Comments have been disabled for this content.