在InnoSetup中添加卸载图标

时间:2013-03-21 19:10:14

标签: icons inno-setup uninstall

我是InnoSetup的初学者。

我有两个图标"iconnew_small.ico""iconnew_smallUninstall.ico",最后一个是Unistall选项。所有文件都在目录C:\mysoftware

我正在关注此example,但在安装后,卸载图标为空(空)

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"

这一切都是innoSetup代码:

; 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

1 个答案:

答案 0 :(得分:5)

首先,您需要在[Files]部分添加一个条目,以指示安装程序将图标文件复制到某个目录中。在以下条目中,它将被复制到应用程序目录中:

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

之后,您需要修复已用于该图标的[Icons]部分条目的IconFilename参数值。使用上面的文件输入路径,您将获得以下图标条目:

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

只需查看[Files]部分中相当长的文件条目列表的旁注。您可以对Source参数使用掩码。所以例如如果您想让安装程序将特定目录中的所有文件包含到您的设置中,并使用相同的标记将它们全部复制到同一文件夹中,您可以使用如下所示的单行:

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