| Author: |
Carlos J. Quintero (Microsoft MVP) |
Applies to: |
Microsoft Visual Studio .NET 2002 |
| Date: |
January 2006 |
|
Microsoft Visual Studio .NET 2003 |
| Updated: |
October 2012 |
|
Microsoft Visual Studio 2005 |
| |
|
|
Microsoft Visual Studio 2008 |
| |
|
|
Microsoft Visual Studio 2010 |
| |
|
|
Microsoft Visual Studio 2012 |
Introduction
This article describes how to detect in a Visual Studio Setup and Deployment
package if Visual Studio .NET is installed as a prerequisite to install an
add-in.
More Information
You can guess if Visual Studio is
installed on a machine searching the registry for these registry keys in the
KKEY_CLASSES_ROOT hive (you can use the regedit.exe tool to explore that
registry hive):
- Visual Studio .NET 2002: "VisualStudio.DTE.7"
- Visual Studio .NET 2003: "VisualStudio.DTE.7.1"
- Visual Studio 2005: "VisualStudio.DTE.8.0"
- Visual Studio 2008: "VisualStudio.DTE.9.0"
- Visual Studio 2010: "VisualStudio.DTE.10.0"
- Visual Studio 2012: "VisualStudio.DTE.11.0"
With this knowledge, we can create a condition in the setup package to check
the existence of one or more of those strings. In this example, we will show how
to create a condition that checks the existence of Visual Studio 2010 or Visual
Studio 2012 with a setup created with Visual Studio 2010 (Visual Studio 2012 no
longer supports Visual Studio setup projects):
- Open Visual Studio 2010.
- Create a new Setup and Deployment Package.
- Select the setup project in the Solution Explorer.
- Click the "Launch Conditions Editor" button on the toolbar of the Solution
Explorer.
- In the Launch Conditions Editor, select the node "Search Target Machine" and
right-click the "Add Registry Search" context menu.
- Name the search "Search for VS 2010".
- In the properties window for this search, enter these values:
Property: VS2010INSTALLED RegKey: VisualStudio.DTE.10.0 Root: vsdrrHKCR Value: empty
- Add another search named "Search for VS 2012" with these values:
Property: VS2012INSTALLED RegKey: VisualStudio.DTE.11.0 Root: vsdrrHKCR Value: empty
- Select the node "Launch Conditions" and right-click the "Add Launch
Condition" context menu.
- Name the condition "VS2010Or2012Installed".
- In the properties window for this condition, enter these values:
Condition: VS2010INSTALLED Or VS2012INSTALLED Message: Visual Studio 2010 or Visual Studio
2012 is required
- Build the setup and test it.
If you have both Visual Studio versions installed on your machine, you can simulate
the absence of one or both of them changing the RegKey values in the searches
specificed above, for testing purposes. For example, if you change both RegKey
values to something like VisualStudio.DTE.A then you can test the behavior of
your setup as if no Visual Studio is installed (without moving to another machine).
Go back to the 'Resources for Visual Studio .NET extensibility' section for more articles like this
|