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
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.)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments