0

I want to make the .msi to not delete some files when upgrading. I saw that I can add files to be deleted but I am not finding any information ot how to say to the .msi "Don't delete this (when upgrading)".

Can someone help me with that?

malkoto1
  • 417
  • 8
  • 19

2 Answers2

2

It's a major upgrade, right? That's a whole new MSI file containing all the files you need. So just make sure that they are also in the new MSI file. That's what everyone does. If your older MSI contains files A,B,C and D and you want the upgrade to "keep" A,B,C so that they are not removed, put them in the upgrade. To be safe, make sure they have the same component IDs. I suspect that you have some assumption about the way these things work that we are not aware of.

PhilDW
  • 20,260
  • 1
  • 18
  • 28
  • Not fair... I asked all the clarifying questions. :) – Christopher Painter Mar 27 '15 at 18:04
  • lol chris, i just jumped straight in with what i thought was the answer because i've seen this many times before :) – PhilDW Mar 27 '15 at 19:15
  • Oh I have to but sometimes it's hard to tell what they really want. I suspected "not delete" meant "not overwrite". – Christopher Painter Mar 27 '15 at 19:21
  • Ok. thank you, but I have one further question: What is being deleted on uninstall by default? Only the install directory or something more than that? – malkoto1 Mar 30 '15 at 11:53
  • Everything that the MSI installs will be uninstalled, files, registry entries etc as tlong as they are not shared, and that includes sharing by an upgrade that goes over the installed product before the old product is uninstalled. Directories are normally removed if they were created by the install and there are no files in it. Files created by user code are not removed. – PhilDW Mar 30 '15 at 18:31
1

I managed to achieve this.

I created two custom actions: one to make backup and one to retrieve the backup.

   <CustomAction Id="BackupCurrentUserConfig"
         BinaryKey="Utility"
         DllEntry="BackupUserConfig"
         Execute="firstSequence" />
   <CustomAction Id="RetrieveUserConfigFromBackup"
         BinaryKey="Utility"
         DllEntry="RetrieveUserConfig" />

And I did scheduled them as follows:

   <InstallUISequence>
      ...
      <Custom Action="BackupCurrentUserConfig" Before="ExecuteAction"></Custom>
   </InstallUISequence>

   <InstallExecuteSequence>
      ...
      <Custom Action="VM_RetrieveUserConfigFromBackup" After="InstallFiles"></Custom>         
   </InstallExecuteSequence>
malkoto1
  • 417
  • 8
  • 19