Skip to content

ProductInstallation Class

Represents a unique instance of a product that is either advertised, installed or unknown.

MethodDescription
CollectUserInfo()Obtains and stores the user information and product ID from an installation wizard.
GetComponentState(component)Gets the installed state for a product component.
GetFeatureState(feature)Gets the installed state for a product feature.
GetProducts(productCode, userSid, context)Enumerates product installations based on certain criteria.
GetRelatedProducts(upgradeCode)Gets the set of all products with a specified upgrade code. This method lists the currently installed and advertised products that have the specified UpgradeCode property in their Property table.
PropertyDescription
AdvertisedLanguageProduct language.
AdvertisedPackageCodeIdentifier of the package that a product is installed from.
AdvertisedPackageNameName of the installation package for the advertised product.
AdvertisedPerMachineTrue if the product is advertised per-machine; false if it is per-user or not advertised.
AdvertisedProductIconPrimary icon for the package.
AdvertisedProductNameHuman readable product name.
AdvertisedTransformsTransforms.
AdvertisedVersionVersion of the advertised product.
AllProductsEnumerates all product installations on the system.
FeaturesGets the set of published features for the product.
HelpLinkThe support link.
HelpTelephoneThe support telephone.
InstallDateDate and time the product was installed.
InstallLocationThe installation location.
InstallSourceThe installation source.
IsAdvertisedGets a value indicating whether this product is advertised on the current system.
IsElevatedChecks whether the product is installed with elevated privileges. An application is called a “managed application” if elevated (system) privileges are used to install the application.
IsInstalledGets a value indicating whether this product is installed on the current system.
ItemGets information about an installation of a product.
LocalPackageThe local cached package.
PrivilegedPatchingAuthorizedTrue if the advertised product can be serviced by non-administrators without elevation.
ProductCodeGets the ProductCode (GUID) of the product.
ProductIdThe product identifier.
ProductNameThe installed product name.
ProductVersionThe product version.
PublisherThe publisher.
RegCompanyThe company that is registered to use the product.
RegOwnerThe owner who is registered to use the product.
SourceListGets the source list of this product installation.
UrlInfoAboutURL about information.
UrlUpdateInfoThe URL update information.
WixToolset.Dtf.WindowsInstaller.dll version 5.0.0+41e11442b2ca93e444b60213b5ae99dcbab787d8

Obtains and stores the user information and product ID from an installation wizard.

public void CollectUserInfo()

This method is typically called by an application during the first run of the application. The application first gets the «see P:WixToolset.Dtf.WindowsInstaller.ProductInstallation.ProductId» or «see P:WixToolset.Dtf.WindowsInstaller.ProductInstallation.RegOwner» . If those properties are missing, the application calls CollectUserInfo. CollectUserInfo opens the product’s installation package and invokes a wizard sequence that collects user information. Upon completion of the sequence, user information is registered. Since this API requires an authored user interface, the user interface level should be set to full by calling «see M:WixToolset.Dtf.WindowsInstaller.Installer.SetInternalUI(WixToolset.Dtf.WindowsInstaller.InstallUIOptions)» as «see F:WixToolset.Dtf.WindowsInstaller.InstallUIOptions.Full» . The CollectUserInfo method invokes a FirstRun dialog from the product installation database. Win32 MSI API: MsiCollectUserInfo

Gets the installed state for a product component.

public InstallState GetComponentState(
string component
)
ParameterTypeDescription
componentstringThe component being queried; GUID of the component as found in the ComponentId column of the Component table.

InstallState Installation state of the component for the product instance: either «see F:WixToolset.Dtf.WindowsInstaller.InstallState.Local» or «see F:WixToolset.Dtf.WindowsInstaller.InstallState.Source» .

Win32 MSI API: MsiQueryComponentState

Gets the installed state for a product feature.

public InstallState GetFeatureState(
string feature
)
ParameterTypeDescription
featurestringThe feature being queried; identifier from the Feature table

InstallState Installation state of the feature for the product instance: either «see F:WixToolset.Dtf.WindowsInstaller.InstallState.Local» , «see F:WixToolset.Dtf.WindowsInstaller.InstallState.Source» , or «see F:WixToolset.Dtf.WindowsInstaller.InstallState.Advertised» .

Win32 MSI APIs: MsiQueryFeatureState , MsiQueryFeatureStateEx

GetProducts(productCode, userSid, context) Method

Section titled “GetProducts(productCode, userSid, context) Method”

Enumerates product installations based on certain criteria.

public static IEnumerable<WixToolset.Dtf.WindowsInstaller.ProductInstallation> GetProducts(
string productCode,
string userSid,
UserContexts context
)
ParameterTypeDescription
productCodestringProductCode (GUID) of the product instances to be enumerated. Only instances of products within the scope of the context specified by the and parameters will be enumerated. This parameter may be set to null to enumerate all products in the specified context.
userSidstringSpecifies a security identifier (SID) that restricts the context of enumeration. A SID value other than s-1-1-0 is considered a user SID and restricts enumeration to the current user or any user in the system. The special SID string s-1-1-0 (Everyone) specifies enumeration across all users in the system. This parameter can be set to null to restrict the enumeration scope to the current user. When is set to the machine context only, must be null.
contextUserContextsSpecifies the user context.

IEnumerable<WixToolset.Dtf.WindowsInstaller.ProductInstallation> An enumeration of product objects for enumerated product instances.

Win32 MSI API: MsiEnumProductsEx

Gets the set of all products with a specified upgrade code. This method lists the currently installed and advertised products that have the specified UpgradeCode property in their Property table.

public static IEnumerable<WixToolset.Dtf.WindowsInstaller.ProductInstallation> GetRelatedProducts(
string upgradeCode
)
ParameterTypeDescription
upgradeCodestringUpgrade code of related products

IEnumerable<WixToolset.Dtf.WindowsInstaller.ProductInstallation> Enumeration of product codes

Win32 MSI API: MsiEnumRelatedProducts

Product language.

public string AdvertisedLanguage { get; set; }

Identifier of the package that a product is installed from.

public string AdvertisedPackageCode { get; set; }

Name of the installation package for the advertised product.

public string AdvertisedPackageName { get; set; }

True if the product is advertised per-machine; false if it is per-user or not advertised.

public bool AdvertisedPerMachine { get; set; }

Primary icon for the package.

public string AdvertisedProductIcon { get; set; }

Human readable product name.

public string AdvertisedProductName { get; set; }

Transforms.

public string AdvertisedTransforms { get; set; }

Version of the advertised product.

public System.Version AdvertisedVersion { get; set; }

Enumerates all product installations on the system.

public static IEnumerable<WixToolset.Dtf.WindowsInstaller.ProductInstallation> AllProducts { get; set; }

Win32 MSI API: MsiEnumProducts ,

Gets the set of published features for the product.

public IEnumerable<WixToolset.Dtf.WindowsInstaller.FeatureInstallation> Features { get; set; }

Because features are not ordered, any new feature has an arbitrary index, meaning this property can return features in any order. Win32 MSI API: MsiEnumFeatures

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionThe installer configuration data is corrupt

The support link.

public string HelpLink { get; set; }

The support telephone.

public string HelpTelephone { get; set; }

Date and time the product was installed.

public System.DateTime InstallDate { get; set; }

The installation location.

public string InstallLocation { get; set; }

The installation source.

public string InstallSource { get; set; }

Gets a value indicating whether this product is advertised on the current system.

public bool IsAdvertised { get; set; }

Checks whether the product is installed with elevated privileges. An application is called a “managed application” if elevated (system) privileges are used to install the application.

public bool IsElevated { get; set; }

Note that this property does not take into account policies such as AlwaysInstallElevated, but verifies that the local system owns the product’s registry data.

Gets a value indicating whether this product is installed on the current system.

public bool IsInstalled { get; set; }

Gets information about an installation of a product.

public string Item[
string propertyName
] { get; set; }
ParameterTypeDescription
propertyNamestringName of the property being retrieved.

Win32 MSI APIs: MsiGetProductInfo , MsiGetProductInfoEx

ExceptionDescription
T:System.ArgumentOutOfRangeExceptionAn unknown product or property was requested
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionThe installer configuration data is corrupt

The local cached package.

public string LocalPackage { get; set; }

True if the advertised product can be serviced by non-administrators without elevation.

public bool PrivilegedPatchingAuthorized { get; set; }

Gets the ProductCode (GUID) of the product.

public string ProductCode { get; set; }

The product identifier.

public string ProductId { get; set; }

For more information, see ProductID

The installed product name.

public string ProductName { get; set; }

The product version.

public System.Version ProductVersion { get; set; }

The publisher.

public string Publisher { get; set; }

The company that is registered to use the product.

public string RegCompany { get; set; }

The owner who is registered to use the product.

public string RegOwner { get; set; }

Gets the source list of this product installation.

public SourceList SourceList { get; set; }

URL about information.

public System.Uri UrlInfoAbout { get; set; }

The URL update information.

public System.Uri UrlUpdateInfo { get; set; }