# msi::get-product-code

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.91.4312.0)