# msi::get-product-code

[This is preliminary documentation and subject to change.]

Returns the product code of the specified Windows Installer database.

### Usage

`string msi::get-product-code(databasePath)`

### Parameters

Name | Type | Description
--- | --- | ---
databasePath | string | The path of the Windows Installer database.

### Return Value

The product code of the specified Windows Installer database.

### Exceptions

The function will fail in any of the following circumstances:

- The specified installer database does not exist.

- The installer database could not be opened.

  -or-

  The product code property is not available in the installer database.

### Examples

- Retrieves the product code of a given installer database, and fails the build if the product is not installed.

      <property name="office.productcode" value=${msi::get-product-code('Office.msi')}" />
      <fail unless="${msi::is-installed(office.productcode)}">Please install Office first.</fail>

### Requirements

Assembly: NAnt.Contrib.Tasks (0.93.5002.0)