Change the default name of an Inno Setup uninstaller to avoid naming conflicts

No. 'unins' is hard-coded in the name generation procedure of the executable, data and msg files, in GenerateUninstallInfoFilename' procedure in 'install.pas' of inno-setup sources.

GenerateFilenames sub procedure has this:

BaseFilename := AddBackslash(BaseDir) + Format('unins%.3d', [I]);
UninstallExeFilename := BaseFilename + '.exe';
..

Where 'I' is an integer and 'BaseDir' is derived from UninstallFilesDir which you can change.


Just dealt with this myself. You shouldn't move the uninstaller executable itself around, for reasons Martin Prikryl pointed out. But I agree it is unsatisfying to have a bunch of numbered uninstallers sitting in a directory with no obvious means of telling which is which.

There is a solution using the facilities Inno Setup provides. In the [Setup] section:

[Setup]
...
UninstallFilesDir=Uninstall\exe\{#NAME_OF_APP}
...

Then in the [Dirs] section:

[Dirs]
...
Name: Uninstall\exe; Attribs: hidden;
Name: Uninstall\exe\{#NAME_OF_APP}; Attribs: hidden;
...

And finally you create named shortcuts in [Icons] that point to the uninstallers which will always have the same name because you've sequestered them:

[Icons]
...
Name: Uninstall\{#NAME_OF_UNINSTALLER}; Filename: Uninstall\exe\{#NAME_OF_APP}\unins000.exe
...

This leaves references in the OS to the uninstallers alone, hides the confusing executable names in a folder the user won't usually see but can still access, and provides named, descriptive shortcuts that can all live in the same folder. You can also give the shortcuts a good icon. For good measure, maybe drop an extra README in the \exe directory to explain what is going on just in case someone gets nosey (they will, naturally).


Inno does this automatically when it detects a different application being installed into the same directory (based on a different AppID). There should be no need to go behind its back and rename the uninstaller files.