FInding the path where Visual Studio is installed

I need help on how I can find the path where Microsoft visual Studio is installed. I need to use this path in my program. What is the function that must be called to get the path where Microsoft Visual Studio is installed?

+3
source share
4 answers

Depending on the application, it is best to ask the user, but here is the 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();
+6
source

You can probably find it by doing a registry search, but since I wanted the solution for the build scripts to use environment variables for this.

N.B. .

VS2005 VS80COMNTOOLS

VS2008 VS90COMNTOOLS

SET VS90COMNTOOLS , : VS90COMNTOOLS = C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\

, .

+6

HKLM\Software\Microsoft\VisualStudio\9.0\InstallDir Visual Studio 2008

+1

Visual Studio?

, -, , Visual Studio.

, , HKCR/Applications/devenv.exe/shell/edit/command VS2008.

0

Source: https://habr.com/ru/post/1708062/


All Articles