Product registration for the About Box in Visual Studio 2010 and the deprecation of IVsInstalledProduct interface

Visual Studio Blog

In this article I’ll talk about the information that needs to be specified by a product integrating with Visual Studio to make that product appear in the About box dialog, and the changes to these settings for Visual Studio 2010.

You are probably familiar by now with the layout of the Visual Studio’s About Box dialog.

AboutBox1

Beside listing general information about the version of Visual Studio installed (build number, release notes, etc), the dialog displays information about the installed products that are part of or integrate with Visual Studio.

There are 4 types of the information a product can display in the About Box dialog. The product name and product identifier are displayed in a list of available products. Once a product is selected in the list, additional information about it (the Product Details) and the product icon are displayed beneath.

The product name and the identifier are mandatory for a product to be listed in the AboutBox. The details and icons are optional.

Products registration keys

Installed products that want to have information displayed in About Box dialog in Visual Studio need to write a couple of registry keys under InstalledProducts key. The keys are read by VisualStudio when the AboutBox dialog is open, and based on these values further information may be obtained from the products resources or from the product’s packages.

E.g. for VS10 and x86 architecture the registry values needs to be written under a key like:

HKLMSoftwareMicrosoftVisualStudio{versionNumber}InstalledProducts{yourProductName}

The {versionNumber} is the version of Visual Studio into which your product is integrating (9.0, 10.0, etc) and {yourProductName} is a registry key string under which detailed registry values will provide further details of the product.

Here is the list of the values that AboutBox reads:

Name

Type

Range

Description

(default value)

REG_SZ

String or resource ID preceded by #

Product name to be displayed to the user in the about box, as a string or as the ID of a string resource in your satellite DLL.

ProductDetails

REG_SZ

String or resource ID preceded by #

Optional product details to be displayed to the user, as a string or as a resource ID in your satellite DLL.

LogoID

REG_SZ

Resource ID preceded by #

Optional resource ID in your satellite DLL of the product icon you want to appear in the about box.

PID  

REG_SZ

String or resource ID preceded by #

Product identifier — a string that can identify your product. This is usually the version of your product; Microsoft products use a GUID that identifies both the product and the edition of Visual Studio that is installed.

Package REG_SZ Guid of the package Package belonging to your product, that either implements IVsInstalledProduct interface or whose satellite DLL contains the resource IDs of the product name, details and logo.
UseInterface REG_DWORD 0, 1 When set, the information to be displayed in about box dialog will be obtained from the product’s package using the IVsInstalledProduct interface; otherwise product registration information is expected to be specified using other registry settings like ProductDetails, LogoID, etc.
UseVSProductID REG_DWORD 0, 1 Reserved for Microsoft products that are part of Visual Studio. When set, the product will display for the PID a unique string identifying the Visual Studio edition installed. The product-specific PID (provided as resource string, resource ID or obtained from the interface) is ignored.

There are 3 ways of declaring the information to be displayed in the About Box dialog:

1) Directly, using registry values 

The products needs to write the (default) and PID values with strings describing the installed product. 
Optionally, the product can write the ProductDetails value.

Example:

[HKEY_LOCAL_MACHINESOFTWAREVisualStudio9.0InstalledProductsKB945282]
@=”Hotfix for Microsoft Visual Studio 2008 Shell (integrated mode) – ENU (KB945282)”
“PID”=”KB945282”
“ProductDetails”=”This hotfix is for Microsoft Visual Studio 2008 Shell (integrated mode) – ENU. If you later install a more recent service pack, this hotfix will be uninstalled automatically. For more information, visit http://support.microsoft.com/kb/945282”

This is the simplest way of registering a product to be listed in About Box. The dialog will display directly the strings read from the registry values.

The method is used by VisualStudio patches, plug-ins or other products that don’t have an associated package integrated with Visual Studio (e.g. Crystal Reports).

The disadvantage of this method is that the registration strings are not localized, and they will show the same no matter what UI language is selected for Visual Studio in Tools/Options/General/International Settings.
Another disadvantage is that products registered using this method will not be able to display an icon in the About box.

2) Using IVsInstalledProduct interface

If the installed product has a package that integrates with Visual Studio, the product needs to write the Package guid and the UseInterface==1 values, then implement the IVsInstalledProduct interface. 

To obtain the registration data, Visual Studio will load the package whose guid was specified and will query the IVsPacakge object for the IVsInstalledProduct interface. VS will further call the methods of this interface to obtain the product name, details, logo, etc. 

Example:

[HKEY_LOCAL_MACHINESOFTWAREMicrosoftVisualStudio9.0InstalledProductsMicrosoft Visual C#]
“Package”=”{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}”
“UseInterface”=dword:00000001

This used to be in Visual Studio 2008 and previous versions the preferred registration method used by Visual Studio components that have a package (e.g. VB, C#, C++, etc).

There is a second (internal) interface Microsoft packages chose to implement, IVsMicrosoftInstalledProduct. This allowed Microsoft products that were part of Visual Studio (e.g. VB, C#) to display a unique PID identifying the Visual Studio edition installed (the Visual Studio Product ID is written in registry keys under HKLMSOFTWAREMicrosoftVisualStudio{version}Registration).

The advantage of this method is that the registration data is provided at runtime by the product’s package. Usually the package reads the data from resources, thus the strings can be localized by providing localized satellite resource dlls.

The disadvantage of the method is that it requires the package to be loaded and initialized (more about this later).

3) Using resource IDs

If the installed product has a package that integrates with Visual Studio, it usually means the package contain embedded resources or the product has satellite dlls containing the resources. The about box registration information can come in this case from resources.

The product needs to write the Package guid, and (default) value with either the name or (more common) the Id of the string resource in the package’s satellite dll. To declare the product ID, the product needs to either write the PID value (as a string or as the #-prefixed Id of resource with the product ID), or if it’s a Microsoft product that is part of Visual Studio it needs to write instead UseVsProductID==1.
Optionally the product can write the ProductDetails and LogoID values.

Example:

[HKEY_LOCAL_MACHINESOFTWAREMicrosoftVisualStudio10.0InstalledProductsMicrosoft SharePoint Development Tools]
“Package”=”{262BA188-21A9-4811-940C-7BE458539388}”
“ProductDetails”=”#3001”
“LogoID”=”#4000”
“PID”=”10.0.21019”
@=”#3000″

In this example, the Microsoft.VisualStudio.SharePoint.Project.dll assembly that implements the 262BA188-21A9-4811-940C-7BE458539388 package contains 2 string resources named “3000” and “3001” and an icon resource named “4000”. They match the product name and details (declared as “#3000” and “#3001” values) and the logo resource id (registered as “#4000”). For the PID, the product chose in this case to provide a string directly in registry.
PackageRes

This is the registration method preferred in Visual Studio 2010 and later by Visual Studio components (VB, C#, TFS, etc).
It it also the usual method of registering 3rd party packages written using Managed Package Framework classes – the sample projects templates using the InstalledProductRegistration attribute with resource values.

The advantage of this method is that registration data comes from resources, thus it can be localized. Another advantage is that the package doesn’t have to be loaded and initialized (only the assembly or the satellite dll will be loaded).
The disadvantage is that more data has to be declared in registry.

 

Deprecation of IVsInstalledProduct interface

As I mentioned before, using the IVsInstalledProduct interface is a convenient way to provide the product information for the about box dialog.

However, this has a big disadvantage: it requires the product’s package to be loaded, instantiated and sited. During the IVsPackage.SetSite() call a package usually performs initialization (like creating toolwindows, allocating memory and initializing global objects, etc), and may trigger additional packages being loaded by querying their services, which in their turn will require time for initialization and may trigger loading of other packages, etc.  All this takes time that’s not necessary for obtaining the about box registration information. It also has an impact on the memory used by Visual Studio (working set), because packages that are loaded are not unloaded until Visual Studio is closed.

In Visual Studio 2010 timeframe there were more packages added to VS and more products used the IVsInstalledProducts interface for declaring their AboutBox data. As result, on debug builds the time to open the dialog skyrocketed to 30-40 seconds(!). Something had to be done…

To fix the problem, the IVsInstalledProduct interface has been logically deprecated. All Visual Studio components had to change their about box registration data from using the interface (method 2) to declaring and using resource IDs (method 3).

If your product uses the interface, it will continue to work in VS10, but the recommendation is to change the product registration to declare resource IDs in registry instead.

The InstalledProductRegistration attribute in MPF classes has also been changed. As described in MSDN, InstalledProductRegistration’s constructor had a “bool useInterface” as first argument.

public InstalledProductRegistrationAttribute (bool useInterface, string productName, string productDetails, string productId)

This constructor allowed developers to use the IVsInstalledProduct interface for providing About Box registration data. However, Visual Studio packages generated with MPF Wizard passed a “false” value to the first argument and instead used explicit resource IDs; the necessary strings and product icon were also generated.

This constructor has been deprecated. If you retarget and compile and old SDK sample project against the newer Microsoft.VisualStudio.Shell.10.0.dll which defines the updated version of the class you’ll get a build warning or error (if warnings are treated as errors). To fix the error simply remove the first argument to InstalledProductRegistration’s constructor.

The current constructor of this class looks like this:

public InstalledProductRegistrationAttribute (string productName, string productDetails, string productId)

One other change to the class is that productDetails argument now accepts a (null) value, if you don’t want to provide additional details about your product.

Alin Constantin

Alin Constantin – Developer, Visual Studio Platform Team
Short Bio: Alin has been at Microsoft for 10 years working on SourceSafe and source control integration in Visual Studio. For Visual Studio 2010, Alin helped writing the code that enabled Visual Studio to move from Windows 32 user interface to a modern UI based on Windows Presentation Framework, worked on localization, About Box dialog improvements, toolbars/menus Customization dialog, etc.

0 comments

Discussion is closed.

Feedback usabilla icon