How can i retrieve devenv.exe path for a vspackage installation?
Asked Answered
P

2

6

I'm following this tutorial http://msdn.microsoft.com/en-us/library/bb458038.aspx to create a VsPackage Setup. In the part of the creation of an installer class appears a reference to this location in the registry "SOFTWARE\Microsoft\VisualStudio\9.0\Setup\VS\EnvironmentPath" where it says that contains the devenv.exe location. I explore the registry and that location doesn't exist. What is the correct location of the devenv.exe path? I'm using Visual Studio 2008

Provenance answered 8/6, 2011 at 17:21 Comment(0)
W
8

I'm sharing my code. It’s working for me.

String path = GetDevenvPath("9.0"); // For VS 2008 
Or
String path = GetDevenvPath("10.0");  For VS 2010

private String GetDevenvPath(String vsVersion)
{
   String vsInstallPath = (String)Registry.GetValue(String.Format("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\{0}", vsVersion), "InstallDir", "");
   return vsInstallPath + "devenv.exe";
}
Wilke answered 15/6, 2011 at 11:16 Comment(1)
Test in Win7 64 bits and XP 32bits ? VS 32 bits and VS 64 bits ?Whipperin
O
5

You need to access HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Setup\VS\EnvironmentPath on 32bit machines and HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\9.0\Setup\VS\EnvironmentPath on 64bit machines.

If you write a 32bit program that reads the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Setup\VS\EnvironmentPath you will be automatically redirected to Wow6432Node on 64bit machines by Windows.

Oratorical answered 17/5, 2012 at 9:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.