Search code examples
visual-studiovb6

FInding the path where Visual Studio is Installed


How I can find the path where Microsoft visual Studio is installed. I need to use that path in my program.

What is the function that has to be called or what other method can I use to get the path where Microsoft Visual Studio is installed?


Solution

  • Depending on the app, it's probably best to ask the user, but here's some C# code that should do the trick for VS2008.

    RegistryKey regKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\VisualStudio\9.0\Setup\VS");
    string vsInstallationPath = regKey.GetValue("ProductDir").ToString();
    regKey.Close();