MsiSetPropertyW function (msiquery.h)

The MsiSetProperty function sets the value for an installation property.


UINT MsiSetPropertyW(
  [in] MSIHANDLE hInstall,
  [in] LPCWSTR   szName,
  [in] LPCWSTR   szValue


[in] hInstall

Handle to the installation provided to a DLL custom action or obtained through MsiOpenPackage, MsiOpenPackageEx, or MsiOpenProduct.

[in] szName

Specifies the name of the property.

[in] szValue

Specifies the value of the property.

Return value

This function returns UINT.


If the property is not defined, it is created by the MsiSetProperty function. If the value is null or an empty string, the property is removed.


The msiquery.h header defines MsiSetProperty as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.


Minimum supported client Windows Installer 5.0 on Windows Server 2012, Windows 8, Windows Server 2008 R2 or Windows 7. Windows Installer 4.0 or Windows Installer 4.5 on Windows Server 2008 or Windows Vista. Windows Installer on Windows Server 2003 or Windows XP
Target Platform Windows
Header msiquery.h
Library Msi.lib
DLL Msi.dll

See also

Installer State Access Functions