Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should Inno Setup delete old files on Update?

Tags:

inno-setup

I'm using Inno Setup to install and update my python application.

On update the installer does not delete py files from the previous installation which creates two problems:

  • I'm using plugins: If I delete a plugin in a new version, it is still there for users who performed an update.

  • When uninstalling an updated installation, files from the old installations will not be removed. (Cannot reproduce...)

How can I force Inno Setup to uninstall my application before upgrading?

Here is my Script:

[Setup]
AppName=Foo
AppVersion=0.1
PrivilegesRequired=lowest
AppId=FooID
RestartIfNeededByRun=False
DefaultDirName={localappdata}\Foo
DisableWelcomePage=True
DisableReadyPage=True
OutputDir=.\win
OutputBaseFilename=setup_Foo
AllowNoIcons=yes
DefaultGroupName=Foo

[Files]
Source: "dist\Foo.exe"; DestDir: "{app}"
Source: "..\*"; DestDir: "{app}\"; Flags: recursesubdirs; Excludes: "*.pyc,installer"

[Icons]
Name: "{group}\Foo"; Filename: "{app}\Foo.exe"; WorkingDir: "{app}"
Name: "{group}\Uninstall Foo"; Filename: "{uninstallexe}"

[Dirs]
Name: "{app}\plugins"

[Run]
Filename: "{app}\Foo.exe"; WorkingDir: "{app}"; Flags: nowait postinstall
like image 434
Hannes Avatar asked Apr 25 '14 07:04

Hannes


People also ask

What is an Inno Setup file?

Inno Setup is a free software script-driven installation system created in Delphi by Jordan Russell. The first version was released in 1997.

What is the use of Inno Setup?

InnoSetup is an open source compiler to create installers on windows. It is free and provides a rich feature set. You can create professional looking installers for the end user. In this article we will explain you the basic concepts and steps involved in creating a simple setup of your C# Project.

Who invented Inno?

Kevin Gundersen - Founder - Inno Supps | LinkedIn.

What language is Inno?

It defines two languages: English, based on the standard Default. isl file, and Dutch, based on a third-party translation.


1 Answers

While it's possible to run the uninstall prior to an upgrade, it is not recommended.

Instead you should use [InstallDelete] entries to remove the specific files that are now redundant. You should know which files these are.

[InstallDelete]
Type: files; Name: {app}\foo.bar
Type: files; Name: {app}\baz\quux.txt

While it is possible to use wildcards, this is not recommended (especially not wildcards that ignore file extensions) as it may unintentionally delete user files, especially if {app} is somewhere unexpected (perhaps they installed directly into their Windows folder).

As for your second assertion, that "When uninstalling an updated installation, files from the old installations will not be removed.", this is simply untrue. As long as you keep the AppId and destination folder the same, then uninstalling will uninstall all previously installed files even after an update. You should use the following setting to help ensure this:

[Setup]
DisableDirPage=auto

Additionally, provided that you have not yet released this application you should consider changing its DefaultDirName to {userpf}\YourAppName instead; this is a better location to install per-user applications. (If you have already released the app, it's still safe to change this value provided that you don't change the AppId, but you'll have to bear in mind that older installations will remain at the older path.)

like image 110
Miral Avatar answered Sep 22 '22 03:09

Miral