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
You can use detection keys in the registry to find out 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. For all keys, check whether the REG_DWORD registry value of "Install" is 1.
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 Microsoft Visual Studio 2012, check the registry key for each LCID to determine whether one of the relevant Visual Studio editions (Ultimate, Premium, or Pro) is installed. Visual Studio supports these LCIDs: 1028, 1029, 1031, 1033, 1036, 1040, 1041, 1042, 1045, 1046, 1049, 1055, 2052, 3082. For a list of all valid LCIDs, see Locale IDs Assigned by Microsoft.
For Microsoft Visual Studio 2012, the Install REG_DWORD value is under the edition, not the LCID, to simplify the detection of an installed product.
Note
In the 64-bit version of Registry Editor, 32-bit keys are displayed under the following registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\. The Visual Studio keys begin as follows: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\DevDiv\vs\Servicing\.
Product |
Key |
---|---|
Visual Studio 2012 Ultimate |
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\vs\Servicing\11.0\ultimate |
Visual Studio 2012 Premium |
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\vs\Servicing\11.0\premium |
Visual Studio 2012 Professional |
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\vs\Servicing\11.0\professional |
Visual Studio 2012 Shell (integrated and isolated) |
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\vs\Servicing\11.0\isoshell |
Visual Studio 2010 Ultimate |
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\vs\Servicing\10.0\VSTSCore\$(Var.LCID) |
Visual Studio 2010 Premium |
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\vs\Servicing\10.0\VSTDCore\$(Var.LCID) |
Visual Studio 2010 Professional |
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\vs\Servicing\10.0\PROCore\$(Var.LCID) |
Microsoft Visual Studio 2010 Shell(Integrated) |
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\vs\Servicing\10.0\IntShell\$(Var.LCID) |
Detecting Updates to Visual Studio 2012
To determine whether an update for Visual Studio is installed, check the registry to verify whether it contains one of the following keys.
Note
In the 64-bit version of Registry Editor, 32-bit keys are displayed under the following registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\. The Visual Studio keys begin as follows: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Updates\Microsoft Visual Studio 2012.
Update version |
Key |
---|---|
Update 1 |
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Microsoft Visual Studio 2012\Update for Visual Studio 2012 Update (KB2781514) |
Update 2 |
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Microsoft Visual Studio 2012\Visual Studio 2012 Update 2 (KB2707250) |
Update 3 |
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Microsoft Visual Studio 2012\Visual Studio 2012 Update 3 (KB2707250) |
Update 4 |
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Microsoft Visual Studio 2012\Visual Studio 2012 Update 4 (KB2707250) |
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.
Note
Detecting the presence of specific programming languages is supported only for Visual Studio 2010 and earlier. For Visual Studio 2012, you can only detect editions, because all programming languages are always installed.
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.
Note
VSPackages that target Visual Studio 2008 and earlier must have a package load key so that they can be validated and loaded. Visual Studio 2010 and Visual Studio 2012 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.