Gianni Spear
Gianni Spear

Reputation: 7924

Add Uninstall Icon in InnoSetup

I am a beginner of InnoSetup.

I have two icons "iconnew_small.ico" and "iconnew_smallUninstall.ico", the last one for the Unistall option. All files are in the directory C:\mysoftware

i am following this example but after the installation the uninstall icon is blank (empty)

Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"; IconFilename: "{app}\C:\mysoftware\iconnew_smallUninstall.ico"

this all innoSetup code:

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "Segmentation Accuracy Tool"
#define MyAppVersion "0.2 Beta"
#define MyAppPublisher "Gianni"
#define MyAppExeName "SegmentationAccuracy.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{B4DD3F33-F6B3-4409-AF7A-D158FC099D39}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName=Segmentation Accuracy Tool
AllowNoIcons=yes
OutputBaseFilename=Segmentation Accuracy Tool
SetupIconFile=C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\iconnew_small.ico
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "brazilianportuguese"; MessagesFile: "compiler:Languages\BrazilianPortuguese.isl"
Name: "danish"; MessagesFile: "compiler:Languages\Danish.isl"
Name: "french"; MessagesFile: "compiler:Languages\French.isl"
Name: "german"; MessagesFile: "compiler:Languages\German.isl"
Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"
Name: "norwegian"; MessagesFile: "compiler:Languages\Norwegian.isl"
Name: "portuguese"; MessagesFile: "compiler:Languages\Portuguese.isl"
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1

[Files]
Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\_ctypes.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\_hashlib.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\_multiprocessing.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\_socket.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\_ssl.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\_tkinter.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\bz2.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\cfitsio.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\gdal19.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\geos_c.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\hdf5_hldll.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\hdf5dll.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\hdfdll.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\libiomp5md.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\library.zip"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\mfhdfdll.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\netcdf.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\numpy.core._dotblas.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\numpy.core._sort.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\numpy.core.multiarray.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\numpy.core.scalarmath.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\numpy.core.umath.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\numpy.fft.fftpack_lite.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\numpy.lib._compiled_base.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\numpy.linalg.lapack_lite.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\numpy.random.mtrand.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\osgeo._gdal.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\osgeo._gdal_array.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\osgeo._gdalconst.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\osgeo._ogr.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\osgeo._osr.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\pyexpat.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\python27.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\SegmentationAccuracy.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\select.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\sz.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\tcl85.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\tk85.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\unicodedata.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\xdrdll.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\xerces-c_2_8.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\zlib1.dll"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
; Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"; IconFilename: "{app}\iconnew_smallUninstall.ico"

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

Upvotes: 3

Views: 3524

Answers (1)

TLama
TLama

Reputation: 76683

As first you need to add an entry into the [Files] section to instruct the installer to copy the icon file into a certain directory. In the following entry it will be copied into the application directory:

[Files]
...
Source: "C\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_‌​project\iconnew_smallUninstall.ico"; DestDir: "{app}"; Flags: ignoreversion

After that, you'll need to fix the IconFilename parameter value of the [Icons] section entry which you've used for that icon. Using the above file entry path, you will get the following icon entry:

[Icons]
...
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"; IconFilename: "{app}\iconnew_smallUninstall.ico"

Just a sidenote looking at quite a long list of file entries in your [Files] section. You might use masks for the Source parameter. So e.g. if you'd like to let installer include all the files from a certain directory into your setup and copy all of them into the same folder using the same flags, you might use single line like this:

[Files]
Source: "C:\PythonScript\Script_fun\Segmentatin_Accuracy\SegmentationAccuracy_executable_project\dist\*"; DestDir: "{app}"; Flags: ignoreversion

Upvotes: 6

Related Questions