I have the following basic wix product:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="TestWriteRegistry" Language="1033" Version="1.0.0.0"
Manufacturer="Granta Test" UpgradeCode="PUT-GUID-HERE">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="TestWriteRegistry" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="TestWriteRegistry" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="ProductComponent">
<File Source ="TestFile.txt" />
</Component>
<Component Id="CESLicenseRegistry" Guid="*" >
<RegistryKey Root="HKLM" Key="SOFTWARE\WOW6432Node\MySoftware\TestKeyRegistry">
<RegistryValue Type="string" Name="ProductKey" Value="[PIDKEY]"/>
</RegistryKey>
</Component>
</ComponentGroup>
</Fragment>
</Wix>
I run this with: msiexec /i "TestWriteRegistry.msi" PIDKEY="123"
The first time I run this, it correctly adds the value in the registry.
I would like to get that if I run the msi again with a different key, this one is updated into the registry. At the moment running it with a different PIDKEY does not write the registry. I assume it is because the Guid for the component is the same so Windows Installer assumes no changes are needed.
Can anyone help me to achieve my intended behaviour?