Desktop Functions:

   Smart Device Functions:

Show Recent Changes
Subscribe (RSS)
Misc. Pages
Helpful Tools
Suggested Reading
Website TODO List
Support Forum
Download Visual Studio Add-In

Terms of Use
Privacy Policy
msiinstallproduct (msi)
The MsiInstallProduct function installs or uninstalls a product.

C# Signature:

[DllImport("msi.dll", CharSet = CharSet.Auto, SetLastError=true)]
static extern UInt32 MsiInstallProduct(string packagePath, string commandLine);

VB Signature:

Declare Function MsiInstallProduct Lib "msi.dll" (packagePath As String, commandLine As String) As UInt32

User-Defined Types:


Alternative Managed API:

Do you know one? Please contribute it!




A null-terminated string that specifies the path to the location of the Windows Installer package. The string value can contain a URL (e.g. http://packageLocation/package/package.msi), a network path (e.g. \\packageLocation\package.msi), a file path (e.g. file://packageLocation/package.msi), or a local path (e.g. D:\packageLocation\package.msi).


A null-terminated string that specifies the command line property settings. This should be a list of the format Property=Setting Property=Setting. For more information, see About Properties.

To perform an administrative installation, include ACTION=ADMIN in szCommandLine. For more information, see the ACTION property.

Return Value
The function completes successfully.

An error relating to an action: For more information, see Error Codes.

Initialization Error: An error that relates to initialization occurred.


The MsiInstallProduct function displays the user interface with the current settings and log mode.

You can change user interface settings by using the MsiSetInternalUI, MsiSetExternalUI, or MsiSetExternalUIRecord functions.

You can set the log mode by using the MsiEnableLog function.

You can completely remove a product by setting REMOVE=ALL in szCommandLine.

Tips & Tricks:

Please add some!

Sample Code:

Please add some!


Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

Access directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version