Detecting System Requirements

A VSPackage cannot function unless Visual Studio is installed. When you use Microsoft Windows Installer to manage the installation of your VSPackage, you can automatically detect whether Visual Studio is installed. The installer can also check the system for other requirements, for example, a particular version of Windows or a particular amount of RAM. You can also configure the installer to use launch conditions to cancel the installation if the VSPackage requirements are not met.

Detection and Servicing Keys

Detection subkeys in the registry let you determine whether a Visual Studio product is already installed on a computer. Servicing subkeys let you detect whether a service release of the product is installed.

The following table lists the detection subkeys for different Visual Studio products.

In the table, LCID represents the locale ID (LCID) for your installation. For a list of valid LCIDs, see Locale IDs Assigned by Microsoft on the MSDN Web site.

In the listed subkeys, dword:00000001 means true, and dword:00000000 means false.

Product

Key

Visual Studio2010 Ultimate

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\VS\Servicing\10.0\VSTSCore\$(Var.LCID)

Visual Studio2010 Premium

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\VS\Servicing\10.0\VSTDCore\$(Var.LCID)

Visual Studio2010 Professional

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\VS\Servicing\10.0\PROCore\$(Var.LCID)

Microsoft VisualStudio 2010 Shell(Integrated)

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\VS\Servicing\10.0\IntShell\$(Var.LCID)

Note

On a 64-bit Windows operating system, the keys begin as follows: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\DevDiv\VS\Servicing\10.0\

Detecting Earlier Versions of Visual Studio

Multiple versions of Visual Studio can be installed on the same computer. For more information, see Supporting Multiple Versions of Visual Studio.

To detect Visual Studio versions, use the following component IDs in the CompLocator table of your Windows Installer package.

CompLocator table rows

Signature_

ComponentID

Type

CL_Devenv_2002

{0C4A71DF-5A73-11D3-A520-00A0C9231BA1}

1

CL_Devenv_2003

{153B059B-B2F4-4B54-9AC3-32BE38E470E1}

1

CL_Devenv_2005

{320DB690-7979-4015-BD78-A16D7279043B}

1

CL_Devenv_2008

{9E43F3BB-E7AE-4A97-ACF6-FB864533CC7E}

1

Use the AppSearch table to connect the Signature_ columns in the CompLocator table to property values, as follows.

AppSearch table rows

Property

Signature_

DEVENV_COMP_2002

CL_Devenv_2002

DEVENV_COMP_2003

CL_Devenv_2003

DEVENV_COMP_2005

CL_Devenv_2005

DEVENC_COMP_2008

CL_Devenc_2008

The values in the Property and Signature_ columns can be any names, but the Signature_ values in the CompLocator and AppSearch tables must match. The property that is linked to your component locator is NULL if the appropriate version of Visual Studio is not installed. If the property is NULL, then conditions tested against the property are false.

Detecting Visual Studio Programming Languages

If your VSPackage requires a particular Visual Studio programming language, use the following CompLocator rows and appropriate AppSearch rows to detect whether the language is installed for particular versions of Visual Studio.

CompLocator table rows to detect whether Visual C# is installed

Signature_

ComponentID

Type

CL_VCsharp_2002

{B881292C-F099-11D4-A547-0090278A1BB8}

1

CL_VCsharp_2003

{6110A574-76CE-45A5-92E8-2E194F20BBF7}

1

CL_VCsharp_2005

{727833BC-8B4B-4480-B34A-B1A17CFF259B}

1

CL_VCSharp_2008

{8D70EE8E-1638-40C2-921B-28E52A68A986}

1

CL_VCSharp_2010

{D3246EF0-4F4E-4F81-B4FF-8C716EC0A929}

1

CompLocator table rows to detect whether Visual C++ is installed

Signature_

ComponentID

Type

CL_VCpp_2002

{00E21CF5-5361-11D3-A51F-00A0C9231BA1}

1

CL_VCpp_2003

{1E8D5C4E-0143-4871-9E7E-F04EEF70C3E0}

1

CL_VCpp_2005

{28A38374-4A68-4562-9AF3-5D7BB96B0461}

1

CL_VCpp_2008

{35DF9D40-8283-4661-B572-F7EACCAB287C}

1

CL_VCpp_2010

{82D71315-B841-492E-986E-2660ABD89CD1}

1

CompLocator table rows to detect whether Visual Basic is installed

Signature_

ComponentID

Type

CL_VBasic_2002

{62EDCDC9-69F4-11D3-A521-00A0C9231BA1}

1

CL_VBasic_2003

{667F7FE3-3165-41C4-9CF9-F2719ADF0505}

1

CL_VBasic_2005

{F5FDD145-7637-4CA7-90FE-6936A082CEDB}

1

CL_VBasic_2008

{F59EAFC0-6C67-40F2-AE59-85E4CE330A4E}

1

CL_VBasic_2010

{235875C7-333C-4186-A46F-064431527642}

1

Detecting Visual Studio Editions

Your package load key enforces the minimum edition of Visual Studio that your VSPackage requires, but you can also detect the edition at installation. For more information, see VSPackage Load Keys.

Note

Visual Studio 2010 VSPackages do not require a package load key.

Preventing a VSPackage from being installed and displaying an explanatory message provides a better user experience than letting the VSPackage be installed and then not work. Use the following RegLocator table rows and appropriate AppSearch table rows to enable Windows Installer to set properties that you can use in conditional tests.

RegLocator table rows to detect Visual Studio editions

Signature_

Root

Key

Name

Type

RL_2002_Professional

2

SOFTWARE\Microsoft\VisualStudio\7.0\Setup\VS\Pro

ProductDir

0

RL_2002_Enterprise

2

SOFTWARE\Microsoft\VisualStudio\7.0\Setup\VS\Ent

ProductDir

0

RL_2003_Professional

2

SOFTWARE\Microsoft\VisualStudio\7.1\Setup\VS\Pro

ProductDir

0

RL_2003_EnterpriseDeveloper

2

SOFTWARE\Microsoft\VisualStudio\7.1\Setup\VS\Ent

ProductDir

0

RL_2003_EnterpriseArchitect

2

SOFTWARE\Microsoft\VisualStudio\7.1\Setup\VS\Arch

ProductDir

0

RL_2005_Standard

2

SOFTWARE\Microsoft\VisualStudio\8.0\Setup\VS\Std

ProductDir

0

RL_2005_Professional

2

SOFTWARE\Microsoft\VisualStudio\8.0\Setup\VS\Pro

ProductDir

0

RL_2005_TeamArchitect

2

SOFTWARE\Microsoft\VisualStudio\8.0\Setup\VS\VSTA

ProductDir

0

RL_2005_TeamDeveloper

2

SOFTWARE\Microsoft\VisualStudio\8.0\Setup\VS\VSTD

ProductDir

0

RL_2005_TeamSuite

2

SOFTWARE\Microsoft\VisualStudio\8.0\Setup\VS\VSTS

ProductDir

0

RL_2005_TeamTest

2

SOFTWARE\Microsoft\VisualStudio\8.0\Setup\VS\VSTT

ProductDir

0

RL_2005_VSTO

2

SOFTWARE\Microsoft\VisualStudio\8.0\Setup\VS\VSTO

ProductDir

0

Detecting When Visual Studio Is Running

Your VSPackage will not be registered correctly if Visual Studio is running when the VSPackage is installed. The installer must detect when Visual Studio is running and then refuse to install the program. Windows Installer does not let you use table entries to enable such detection. Instead, you must create a custom action, as follows: Use the EnumProcesses function to detect the devenv.exe process, and then either set an installer property that is used in a launch condition or conditionally display a dialog box that prompts the user to close Visual Studio.

Canceling Setup By Using Launch Conditions

If any of the requirements of your VSPackage are not met, you can use the Windows Installer package LaunchCondition table to cancel installation. The LaunchCondition table has a row for every launch condition and a message to display for every condition that is not met. The following table lists LaunchCondition table rows that use Windows Installer system properties and custom detection properties that were set up earlier.

Note

Because registering a VSPackage requires writing registry values to the HKEY_LOCAL_MACHINE key, VSPackage installation requires elevated user rights, even if actually running the VSPackage does not require elevated permissions.

Sample LaunchCondition table rows

Condition

Description

DEVENV_COMP_2002 OR DEVENV_COMP_2003 OR DEVENV_COMP_2005 OR

DEVENV_COMP_2008 Installed

This VSPackage requires Visual Studio.

VersionNT => 500

Windows 2000 is the minimum requirement for the VSPackage.

NOT VISUAL_STUDIO_RUNNING

Close Visual Studio before you install this VSPackage.

Privileged

To install this VSPackage, elevated user rights are required.

Note

If you rely on the AppSearch table to set the properties you want to use in the LaunchCondition table, the AppSearch standard action must appear before LaunchConditions in the InstallUISequence table and the InstallExecuteSequence table.

See Also

Other Resources

Installing VSPackages By Using Windows Installer