Search code examples
wixwindows-installerwix3

PYRO0243 while building patch


I had the following "Reg2015" component in RTM in which I forgot to assign KeyPath:

<DirectoryRef Id="INSTALLLOCATION">
 <Component Id="Reg2015" Guid="{xxx}" Win64="no" >
  <RegistryKey Root="HKLM" Key="SOFTWARE\Mine" >
   <RegistryValue Name="RefCount" Value="1" Type="integer" />
   <RegistryValue Name="Name" Value="Mine" Type="string" Action="write" />
  </RegistryKey>
 </Component>
...
</DirectoryRef>

To prepare the patch, I changed "RefCount" to "2" and added to patch wxs.

Now PYRO.EXE complains like this:

error PYRO0243: Component 'Reg2015' has a changed keypath in the transform 'C:\Patch\Patch.Wixmst'. Patches cannot change the keypath of a component.
error PYRO0260: Product '{xxx}': Table 'CreateFolder' has a new row 'INSTALLLOCATION/Reg2015' added. This makes the patch not uninstallable.

I understand since there was no "KeyPath", its KeyPath defaulted to INSTALLLOCATION, but didn't know that component ID was considered as a directory.

(1) Can someone explain why?

(2) Is there any way to pass PYRO errors?

(3) For my next major release, if I add "KeyPath" to any of "RegistryValue" element, like

<RegistryValue Name="RefCount" Value="1" Type="integer" KeyPath="yes" />

should I be able to change "RefCount" to 2 in the future patch?

Thanks.


Solution

  • I think WiX selected Refcount as the keypath for the component - that's what the docs say. " If KeyPath is not set to 'yes' for the Component or for a child Registry value or File, WiX will look at the child elements under the Component in sequential order and try to automatically select one of them as a key path. Allowing WiX to automatically select a key path can be dangerous because adding or removing child elements under the Component can inadvertantly cause the key path to change, which can lead to installation problems. " You could verify that by looking in the MSI file with Orca to see what the Component table says about it.

    So changing the keypath value probably resulted in that issue. It would be better to set another registry item (or create a new one) in the component to be the keypath.