tags:

views:

76

answers:

5

I have release an application with Inno Setup. Sadly this application had installed a DB file as a source file, so if the application is uninstalled then entire DB file is removed.

I'm going to release a new version soon. I would like the new version to override previous one, not install DB file at all and instead create the DB by the application itself.

If I install the new version without ever installing the original one, everything works fine. The application creates a DB file and after uninstalling, the DB stays on the machine.

The problem is that if I had installed the previous version on the machine and then installed a new version, then after uninstalling the new version the DB file is always removed.

Both application go to the same directory with the same AppId.

How can I revoke a file removal scheduled by the previous installer?

A: 

Try changing your AppID in your script.

From the InnoSetup help file:

The value of AppId is stored inside uninstall log files (unins???.dat), and is checked by subsequent installations to determine whether it may append to a particular existing uninstall log. Setup will only append to an uninstall log if the AppId of the existing uninstall log is the same as the current installation's AppId.

Edelcom
I need the same AppId, since I want to have a single uninstaller. Otherwise I would end up with two uninstallers, and this would make the case even worst.
agsamek
Changing the `AppId` would also lead to two entries in the Software applet.
mghie
+3  A: 

You can keep installing a database file if you add the uninsneveruninstall flag. This would leave the file and the directory when the application is uninstalled. Unfortunately adding this flag now won't help, as the uninstall will still remove the database file - the file entry for the database file from the initial installation isn't modified by later installations, so the database file will always be removed. There seems to be no way around this.

What you can do is adding code to your new installer (or uninstaller) that makes a backup copy of the database file. The file and the directory will then be preserved, as the uninstaller does per default not delete anything that the installer hasn't created.

mghie
A: 

This is rather an advanced topic (I think).

I would suggest asking this question in the news group of innosetup:

news://news.jrsoftware.org/jrsoftware.innosetup

Please, if you receive an answer in the news group, post the result here.

Edelcom
+1  A: 

In the new version, I suggest you create the DB file with a different name. That would be a simple way to ensure that it would never be uninstalled by any previous installer.

Your installer for the new version (using some Pascal script), or perhaps the application itself, could detect the DB with the old name, if it exists, and:

  • copy the data from the old to the new file
    • perhaps rename the old one as a backup with a different name
  • or perhaps just rename the file to the new name

You would have to be careful to consider all the possible install, uninstall, reinstall scenarios and not to mess up the data in each scenario.

Craig McQueen
+1  A: 

Thank you for your responses. I agree that the most obvious solution here is to copy the DB file to a new location and forget about the problem. So my upvote goes to mghie.

I managed to achieve what I needed by removing unins000.* files though:

[InstallDelete]
Type: files; Name: "{app}\unins000.dat"
Type: files; Name: "{app}\unins000.exe"

I needed to remove both files. Additionally I had to reinstall all files with "ignoreversion" flag, so that they are to be removed by the new uninstaller:

[Files]
Source: {#SourceFileDir}\my.exe; DestDir: {app}; Flags: ignoreversion

This has some drawbacks of course and is not 100% safe, but works in my case.

agsamek
+1, for a creative solution. Maybe it helps someone else down the road too, but I would test all possible scenarios extra thoroughly.
mghie