質問

I've migrated my VS extension from VS2010 to 2012 today, and when debugging the extension via the experimental hive, it seems to be creating a new registry entry for the _Config directory, with new number every time, e.g.:

HKCI\Software\Microsoft\VisualStudio\11.0Exp_Config_12944

I assumed the later was the process ID for the new devenv.exe instance, but it isn't.

I have some custom code that needs to read a value from this config dir, I use __VSSPROPID.VSSPROPID_VirtualRegistryRoot to get the registry root:

object property;
 _vsShell.GetProperty((int)__VSSPROPID.VSSPROPID_VirtualRegistryRoot, out property);
return property.ToString();

I would simply append "_Config" to the property value, but now it seems that it's not the case anymore.

Is there either a way to prevent VS2012 experimental hive appending that number, and just use 11.0Exp_Config, or is there a way (API, flag) to retrieve the config registry root?

役に立ちましたか?

解決

Thanks to Hans' comment above, I was able to solve the problem using ILocalRegistry4.GetLocalRegistryRootEx, passing in the __VsLocalRegistryType.RegType_Configuration enum.

// previous code deleted

EDIT: Upon further investigation, there seems to be a much better way - a class that already does this, accepting __VsLocalRegistryType as parameter: VSRegistry, also conveniently returning RegistryKey:

public RegistryKey ConfigRoot
{
    get { return VSRegistry.RegistryRoot(__VsLocalRegistryType.RegType_Configuration); }
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top