4

In WIX I'd like a feature to be installed and uninstalled normally but not to be touched during repair.

I was not able to find a condition which would allow me to do this. My attempts has failed: the feature is reinstalled on repair (what I do not need) or is not uninstalled.

This is a sample that I tried last:

<Feature Id="aFeature" Title="A Features" Level="1">
  <ComponentRef Id="aComponent" />
  <Condition Level="0">
    <![CDATA[WixUI_InstallMode="Repair"]]>
  </Condition>
</Feature>

What is the right condition to uninstall but not re-install during repair? Or what did I do wrong?

Erik
  • 503
  • 1
  • 7
  • 26
VikVik
  • 1,045
  • 2
  • 11
  • 15

2 Answers2

3

This works for me:

<Feature Id="aFeature" Title="A Features" Level="1">
  <ComponentRef Id="aComponent" />
  <Condition Level="0">
     <![CDATA[REINSTALL<>""]]>
  </Condition>
</Feature>

This way during Repair the feature is ignored and not touched, but normally uninstalled

VikVik
  • 1,045
  • 2
  • 11
  • 15
  • 1
    It might appear to work, but the docs are against you. https://msdn.microsoft.com/en-us/library/aa368007(v=vs.85).aspx says that after a component is installed it remains enabled whatever condition you may use later unless you initially installed the component as transitive. See the note on the Condition. – PhilDW Mar 04 '15 at 17:49
  • Note, he's describing setting this on the feature, not the component. https://msdn.microsoft.com/en-us/library/aa368585(v=vs.85).aspx Which states a level of 0 is excluded even during maintenance operations. – JShumaker Sep 14 '15 at 16:05
1

The only way I can think of is to give all the components in that feature an empty guid, that's the signal to Windows Installer not to do anything with them, such as repair them, patch them, uninstall them. If the product is already shipped it's too late for that. However that's a drastic step that is normally necessary only when you want to install some things for temporary use and then delete them. So you are fighting the framework here. It's look like you have a problem that disabling feature repair might solve, so why not describe the problem to see if there is another solution?

PhilDW
  • 20,260
  • 1
  • 18
  • 28
  • I thought that I described my problem: a feature must be uninstalled normally, but ignored during repair. The feature has lots of components related to IIS and SQL installations as well as config modifications. – VikVik Mar 02 '15 at 18:13
  • But why defeat repair? Because a custom action runs? Again, it looks like you are describing a solution to a problem that disabling repair will solve, but what is that problem? If the issue really is that you are running custom actions, as the config modification suggest, then the problem is that you have custom actions with incorrect conditions. If that is the problem, then do an update install to correct those conditions so that they do not run during the install. Asking the question "how do I stop repair custom actions running" sounds like it might be a better question. – PhilDW Mar 02 '15 at 18:25
  • Phil, please answer only if you have an answer to the original question. It has nothing to do with CA. I have dozens of features some of which should not be touched during repair but should be normally installed and cleanly uninstalled. – VikVik Mar 02 '15 at 20:20
  • To the best of my knowledge what you want to do is not possible. Therefore I'm looking for other ways to solve the problem. I'll stop trying to help if this is not useful. – PhilDW Mar 03 '15 at 18:01
  • I think I found proper condition: <![CDATA[REINSTALL<>""]]>. I have problems with uninstalling Web Applications, but this is different problem. – VikVik Mar 03 '15 at 20:25