In our product we use Product Id="*"
in Wix to tell it to generate a new product code for every new build. We now have a requirement during install time to record the product code of the MSI being installed into one of our registry keys. We could infer the product code at runtime by looping through entries in the "Uninstall" registry keys looking for our product name and version, but it would be cleaner to directly record this information at install time.
Is there a way for Wix to tell me what ProductCode
it has generated so that I can add it as a variable to a RegistryValue
Wix element?
I'm guessing there isn't, so I tried using a <?define?>
to set a variable to all question marks "????????-????-????-????-????????????"
and used this variable in the Product
element as well as the RegistryValue
element. This works for the Product
element ok, it continues to generate a new GUID, but in the RegistryValue
element this variable is not expanded at compile time, meaning the registry key simply gets added with all question marks.
Is there any pure Wix way to achieve what I want? I could generate the ProductCode
outside of Wix and have the Wix elements use this as an environment variable, but this adds an extra level of complexity to the build process - something else that could break. I would like it if I could do this purely with Wix.