none
Removing files during minor upgrades

    Question

  • This is something which confuses me time and again. We have a requirement to remove files during a minor upgrade. These files have been installed as part of our initial install. We are planning to provide a minor upgrade packaged as a full installer. As part of the minor upgrade process, we would like to have some files removed.

    Now i have consistenly come across two suggested approaches:

    1)Remove just the file, not the component. Populate the  RemoveFiles table with this information.

    I have myself followed this approach a number of times and it works correctly. In my case all of such removed files were the key files for those components.

    However what confuses me is the numerous links i have seen which suggest that the key file cannot be altered/removed as part of a minor upgrade.

    Here are those links:

    http://kb.flexerasoftware.com/doc/Helpnet/installshield12helplib/MajorMinorSmall.htm

    http://kb.flexerasoftware.com/doc/Helpnet/installshield15helplib/ConfiguringMinorUpgsRemoveInstalledData.htm

    http://msdn.microsoft.com/en-us/library/aa367850(VS.85).aspx

    I am using InstallShield as the authoring tool. However irrespective of the authoring tool, the windows installer rules should be applicable everywhere.

    What is the correct approach? Can we remove key files during a minor upgrade retaining the components? Are there any circumstances under which this approach should not be used?

    Thanks,

    Kiran Hegde

     

     

     

    Tuesday, June 29, 2010 4:29 AM

Answers

  • You cannot remove files during a minor upgrade (same as a patch).  Actually it's more correct to say you cannot delete or move components.  If you want the *file* to be absent from the system you keep the component, but in the minor upgrade you mark the component transitive (becomes msidbComponentAttributesTransitive in the Component table) and then give the component a condition of 0.  That keeps the component rules intact, but the file will be absent.

    It's not safe to remove and installed file because repair might discover that and reinstall it.


    Phil Wilson
    • Marked as answer by Kiran N Hegde Wednesday, July 07, 2010 3:50 AM
    Tuesday, June 29, 2010 6:25 PM
    Moderator

All replies

  • Hi Kiran,

    Before we go any further, could you please let us know your understanding of the key file? It has two meanings based on my understanding:
    1. Very important files, those will be installed the first time and hardly changed during updating. When we update a product or add a patch, these files will not be changed.
    2. The files related to authoring, such as a product key showing that you buy this product.

    From the document in the first link you mentioned, I think it means the first case.

    Regards,
    Aland Li

    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
    Tuesday, June 29, 2010 2:27 PM
    Moderator
  • You cannot remove files during a minor upgrade (same as a patch).  Actually it's more correct to say you cannot delete or move components.  If you want the *file* to be absent from the system you keep the component, but in the minor upgrade you mark the component transitive (becomes msidbComponentAttributesTransitive in the Component table) and then give the component a condition of 0.  That keeps the component rules intact, but the file will be absent.

    It's not safe to remove and installed file because repair might discover that and reinstall it.


    Phil Wilson
    • Marked as answer by Kiran N Hegde Wednesday, July 07, 2010 3:50 AM
    Tuesday, June 29, 2010 6:25 PM
    Moderator
  • Hi Kiran,

    How is the issue now? Does PhilWilson's reply helps?

    Regards,
    Aland Li

    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
    Thursday, July 01, 2010 3:24 AM
    Moderator
  • It does help but i have more questions for Phil.

    Here is what  MSDN has to say:

    The update can add, remove, or modify the files, registry keys, or shortcuts of components that are not shared by two or more features. If the update modifies a versioned file, that file's version must be incremented in the File table. If the update removes resources, it should also update the RemoveFile and RemoveRegistry tables to remove any unused files, registry keys, or shortcuts that have already been installed.

    Questions:

    1)In my previous experience, i have even removed files (not the components) by populating the RemoveFiles table. Infact these components to which the files belonged to were shared among different features.Have i violated any windows installer rule by doing so? If yes, then why did i not run into any issues.

    2)There was another email discussion on the wix groups http://www.mail-archive.com/wix-users@lists.sourceforge.net/msg16312.html where marking a component as transitive gave rise to problems duirng patch uninstallation. What are the issues we generally run into during a patch uninstall, if the above approach is followed?

    Any help would be very much appreciated.

    Regards,

    Kiran Hegde

     

     

    Thursday, July 01, 2010 8:57 AM
  • My understanding is that that the RemoveFile is equivalent to just removing files manually and therefore shouldn't be done. The only solution I've ever seen recommended is to use Transitive. I don't know why you have not had issues if you broke the rules, but then that's like the guy falling out of the airplane without a parachute saying "well, so far so good". However, component rules are very much about sharing, patches, upgrades etc, and if you haven't done any of those yet you won't see any yet.

    If you are shipping a complete MSI setup as a minor upgrade and you want to add files, why not package it as a major upgrade? 

    I didn't see anything in that WiX thread about transitive breaking anything to do with patches. You may be misinterpreting Bob's response. It did not say there as a patch uninstall problem, just a <g> joke about removing files by allowing patches to be uninstalled.


    Phil Wilson
    Thursday, July 01, 2010 8:55 PM
    Moderator
  • However, component rules are very much about sharing, patches, upgrades etc, and if you haven't done any of those yet you won't see any yet.

    I have followed the first approach mentioned in  http://kb.flexerasoftware.com/doc/Helpnet/installshield15helplib/ConfiguringMinorUpgsRemoveInstalledData.htm as part of my patches. I have not had any issues so far and have delivered numerous patches.

    If you are shipping a complete MSI setup as a minor upgrade and you want to add files, why not package it as a major upgrade? 

    I guess you meant **remove** here instead of  add.

    This is what Bob has said:


    The need to remove files is a sign that you should consider using a
    major upgrade. It's possible to remove files but you've discovered the
    drawback. You need to add RemoveFile table rows to have a patch delete
    the file and it complicates patch uninstall. (See "Uninstallable
    Patches" in the MSI SDK for details.)

    The general recommendation is to do nothing, just leave the files there.
    You can also replace it with a zero-byte or nulled-out file.

    So my question: How/why patch uninstalls get affected?

    Regards,

    Kiran Hegde

     

     

     

     

    Friday, July 02, 2010 8:51 AM
  • I don't know - Bob is on the WiX list so you could ask him there, but rules for uninstallable patches in the SDK mentions that adding files makes them uninstallable, and so does changing certain tables - it might be something to do with that.
    Phil Wilson
    Friday, July 02, 2010 9:24 PM
    Moderator
  • Hi Kiran,

    How is the issue now? Does PhilWilson's reply helps?

    Regards,
    Aland Li

    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
    Tuesday, July 06, 2010 11:27 AM
    Moderator
  • One last question.

    Are we not supposed to  **add** files by introducing new components during a minor upgrade?

    My understanding is that **removing**  files would be harmful as Phil has already outlined. However  what about **adding** new files?
    Regards,
    Kiran Hegde

     

    Wednesday, July 07, 2010 3:55 AM
  • So my question: How/why patch uninstalls get affected?
    By creating a ReolveSource aciton for the missing file that needs to be not missing again if you uninstall the patch? Maybe means putting the cd back in the drive or worse if it was installed from a download that they don't have anymore.
    Wednesday, March 21, 2012 9:48 AM