In WiX, where is the ProductCode specified

wix

I'm using WiX to create an installer, and in order to uninstall my application from the command line (using MsiExec.exe /X{...}) I need to know the ProductCode for my .msi file.

When I install my application, I can see that the ProductCode is listed in the installation log file. However, the GUID shown does not feature anywhere in my WiX files. It also seems to change between builds of my installer.

Can I specify the ProductCode somewhere in my WiX .wsx file? If so, where?

Best Answer

The product code is the Id of the Product element.

Specifying a guid

<Product Id="INSERT_GUID_HERE" 

Specifying a '*' makes the GUID auto generate every time

<Product Id="*"

Or you can store the product code as a variable in a config.wxi file and reference it like so

<Product Id="$(var.MyProductCode)"
Related Topic