views:

25

answers:

1

I have created an WiX 3.5 installer with multiple features. One feature performs some XML changes which works fine. I have read that these changes can be undone while uninstalling the application by using the permanent attribute.

Now imagine the following case: The user installs the whole application. Feature 1 does some XML changes. Now the user restarts the MSI in maintenance mode to remove Feature 1. By removing feature 1 the XML changes should be removed as well but they are not.

So how can I convince my MSI to remove the XML changes this way?

A: 

This might be the case if the component holding the xml:config element is referenced from any other feature. Verify that it is only this Feature 1 which references the component. It's just a guess, though - never tried this.

Hope this helps.

Yan Sklyarenko
Actually feature 2 is installing an XML file and feature 1 is making some changes on this file... So you think the XML changes are not removed since they are made on a file created by another feature?
Marcus
I take it the XML changes reside in a separate component, right? What's the KeyPath of that component? Is it referenced from any other component which is not removed when you remove Feature 1?
Yan Sklyarenko
Well, to tell it short, XML extension behavior (like other standard WiX extensions) is tied to the component the element resides in and its KeyPath.
Yan Sklyarenko
To sum it up: It is not possible to remove XML changes when the XML file itself is placed in another feature (since it therefore lies within another component).
Marcus
That's actually not what I meant. Features can reference the same component. If your Feature 1 and Feature 2 both reference the component with File and XmlConfig, than the XML changes won't be removed if you remove one of the features. IF you instead place the File element marked as KeyPath into one component and reference it in Feature 1, AND place a XmlConfig element and e.g. RegistryKey element marked as KeyPath into another component and reference it in Feature 2, THEN when you remove Feature 2, it should remove the XML changes leaving the file itself on the target machine.
Yan Sklyarenko
Sounds interesting... I'll give it a try later this week and report the result ;)
Marcus
I have tried it this way but it does not work. After removing Feature 2 the XML file stays "untouched", although the XMLChanges component belongs to feature 2. I have now set some conditions which will allow installing/uninstalling of features only in cooperation with dependent features.
Marcus