Can anybody explain me this behavior? Steps:
If i change registry value in patch B (step 3) to ZZZ it again works well. I found workaround. I had to move component with that registry to separate Feature. Then it works without problem.
Wix code before workaround:
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
<Package
Name="App"
Language="1033"
Version="2.0.0.8"
Manufacturer="Develop"
UpgradeCode="{E0EC963D-82A9-410E-93BA-11243A15E534}"
InstallerVersion="500"
ProductCode="{596EF69B-157C-4C02-A566-1ED06C68B67B}">
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<DirectoryRef Id="APPDIR">
<Component Id="CMP_SetReg" Guid="{F0BD26A4-D356-4F17-BF60-4AC3EE7B820A}">
<RegistryValue Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\[ProductCode]" Action="write" Name="MyComments" Type="string" Value="XXX" KeyPath="yes"/>
</Component>
<Component Id="CMP_fileA" Guid="1307a453-6683-479f-a1be-f0fdc0d22cd5">
<File Id="FILE_fileA" Source="$(var.Path)..\app.exe" KeyPath="yes" />
</Component>
.
.
</DirectoryRef>
<Feature Id="Main" Display="hidden" Level="1" ConfigurableDirectory="APPDIR" Title="Main program" >
<ComponentRef Id="CMP_SetReg" />
<ComponentRef Id="CMP_fileA" />
.
.
</Feature>
<Feature Id="Optional" Level="1" Title="Services">
<Feature Id="Service1" Level="1" Title="Service1" >
<ComponentRef Id="..." />
</Feature>
.
.
</Feature>
<CustomAction Id=...
.
.
</Package>
</Wix>
Patch code:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Patch
AllowRemoval="yes"
Classification="Update"
DisplayName=".."
Manufacturer=".."
MoreInfoURL="..">
<Media Id="1000" Cabinet="MyPatch.cab">
<PatchBaseline
Id="MyPatch"
BaselineFile="Setup.wixpdb"
UpdateFile="SetupNew.wixpdb" />
</Media>
<PatchFamily
Id="MyPatchFamily"
Version="2.0.0.9"
Supersede="yes">
<ComponentRef Id="..." />
.
.
</PatchFamily>
</Patch>
</Wix>
Patching files works without problem, only registry patching has this weird behavior. I dont understand why.
My guess is that your patch B supersedes patch A so it removes patch A from the view during the patch application, reverting the value to what was in the MSI. PatchFamilies can only grow.