Search code examples
visual-studio-extensions

VSIX - Get RootSuffix in Visual STudio extension


To debug Visual Studio extensions you can start an experimental instance with a certain "RootSuffix". See https://learn.microsoft.com/en-us/visualstudio/extensibility/the-experimental-instance?view=vs-2022.

Is there a way to know the provided rootsuffix in the code of your extension?

I.e. "Exp" if the instance was started with "devenv.exe /RootSuffix Exp"


Solution

  • Can be retrieved with following code:

    IVsAppCommandLine cmdline = (IVsAppCommandLine)GetService(typeof(SVsAppCommandLine));
    cmdline.GetOption("rootSuffix", out var present, out var value)