How to determine whether a VS 2005 product is installed on a computer

A customer asked a question last week about how to detect whether or not Visual Studio 2005 is installed on a computer, and if so, which edition is installed and what location it is installed to. There are a ton of registry keys written by VS 2005 setup, so deciding which keys are safe to use to detect the presence and location of this family of products can be tricky, especially when you factor in all of the various editions and non-English languages. In addition, we unfortunately have not yet designed a registry hive specifically to allow applications to detect the presence of Visual Studio like we have in the .NET Framework and other redistributable packages that are installed as a part of Visual Studio setup.

Here is a list of the registry keys/values that can be used to detect each of the editions of Visual Studio 2005. In each case below, ProductDir is a REG_SZ value that contains the install root (which by default will be c:\Program Files\Microsoft Visual Studio 8).

If you do not care which edition is installed, you can use the following registry value to detect whether or not any edition of Visual Studio 2005 is installed:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7\8.0

8.0 is a REG_SZ value that specifies a fully qualified path to the Visual Studio 2005 root installation directory. By default, this value will be set to c:\Program Files\Microsoft Visual Studio 8, but will be different if the user has installed Visual Studio 2005 to a non-default path.

<update date="12/1/2006"> Added a registry value that can be used to detect the presence of any edition of VS 2005 if you do not care about which edition is installed </update>