Detecting System Requirements

Visual Studio must be installed on a user's computer for a VSPackage to function. Microsoft Windows Installer automatically supplies data like the version of the operating system. It also detects the presence of Visual Studio by supplying the necessary data to search a system for installed products.

Your VSPackage might have other requirements, such as a particular version of Windows or a particular amount of RAM. If your VSPackage's system requirements are not met, you can cancel the installation by using launch conditions.

Detecting 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 each version of Visual Studio, use the following component IDs in your Windows Installer package's CompLocator table. The values in the following two tables apply to Visual Studio .NET 2002, Visual Studio .NET 2003, Visual Studio 2005, and Visual Studio 2008.

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.

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 linked to your component locator is NULL if the appropriate version of Visual Studio is not installed. If the property is NULL, then condition tests 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 installed languages for a particular version 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

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

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

CompLocator table rows to detect whether Visual J# is installed

Signature_

ComponentID

Type

CL_VJsharp_2003

{4451229A-04AA-495C-A4AC-663B9743758D}

1

CL_VJsharp_2005

{326BBDD5-9195-4866-B764-F0985045FD66}

1

Detecting Visual Studio Editions

Your package load key enforces a minimum edition of Visual Studio that your VSPackage requires, but you can also detect the edition at install time. For more information, see VSPackage Load Keys. Displaying a message and preventing a VSPackage from installing provides a better user experience than installing and not working. Use the following RegLocator table rows and appropriate AppSearch table rows to have Windows Installer set properties 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 register correctly if Visual Studio is running when a user installs your VSPackage. Your installer must detect when Visual Studio is running and refuse to install the program. Windows Installer does not provide such detection capabilities through table entries. You must create a custom action. You can use the EnumProcesses function to detect the devenv.exe process. You can then either set an installer property used in a launch condition or conditionally display a dialog box prompting the user to close Visual Studio.

Canceling Setup with Launch Conditions

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

Note

Because registering a VSPackage requires writing registry values to the HKEY_LOCAL_MACHINE key, a user installing a VSPackage must always have elevated privileges. Whether your VSPackage requires elevated privileges to run depends on its design.

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

Please close Visual Studio before installing this VSPackage.

Privileged

This VSPackage requires elevated (system) privileges to be installed.

Note

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

See Also

Other Resources

Load Key Values in the Windows Registry