简体   繁体   中英

InnoSetup - Does not create any icon?

I am expecting my installer to create shortcut icons on the Desktop.

It has created one of the icons:

仅创建了一个图标,但没有快捷键

But not the other two. What am I doing wrong here?

#define MyAppName "Stackoverflow.Camera"
#define MyAppVersion "20"
#define MyAppPublisher "Stackoverflow"
#define MyAppURL "https://www.stackoverflow.com/"
#define MyAppExeName "cam.exe"
#define SerialNumber "1234"

[Setup]
AppId={{C4CB10EA-7599-4A1C-BE0C-5A560FD9EE23}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DisableDirPage=yes
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
OutputDir=C:\Users\tpt\Desktop
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
;SignTool=signtool
PrivilegesRequired=admin
UserInfoPage=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"


[Files]
Source: "C:\test\cam\Samples\cam\bin\Release\*"; DestDir: "{app}\"; Flags: ignoreversion; Permissions: users-full

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userdesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; HotKey:"ctrl+alt+c";Tasks: desktopicon

[Run]
Filename: "{app}\{#MyAppExeName}"; 


[Code]

function CheckSerial(Serial: String): Boolean;
begin
  Result := Serial = '{#SerialNumber}';
end;

Compile Log

*** Starting compile.  [9:57:55 PM]

[ISPP] Preprocessing.
[ISPP] Preprocessed.

Parsing [Setup] section, line 10
Parsing [Setup] section, line 11
Parsing [Setup] section, line 12
Parsing [Setup] section, line 14
Parsing [Setup] section, line 15
Parsing [Setup] section, line 16
Parsing [Setup] section, line 17
Parsing [Setup] section, line 18
Parsing [Setup] section, line 19
Parsing [Setup] section, line 20
Parsing [Setup] section, line 21
Parsing [Setup] section, line 22
Parsing [Setup] section, line 23
Parsing [Setup] section, line 24
Parsing [Setup] section, line 25
Parsing [Setup] section, line 27
Parsing [Setup] section, line 28
Reading file (WizardImageFile)
   File: C:\Program Files (x86)\Inno Setup 5\WIZMODERNIMAGE.BMP
Reading file (WizardSmallImageFile)
   File: C:\Program Files (x86)\Inno Setup 5\WIZMODERNSMALLIMAGE.BMP
Preparing Setup program executable
Reading default messages from Default.isl
Parsing [Languages] section, line 31
   File: C:\Program Files (x86)\Inno Setup 5\Default.isl
Parsing [LangOptions], [Messages], and [CustomMessages] sections
   Messages in script file
Reading [Code] section
Parsing [Tasks] section, line 38
Parsing [Icons] section, line 41
Parsing [Icons] section, line 42
Parsing [Icons] section, line 43
Parsing [Run] section, line 46
Parsing [Files] section, line 35
Compiling [Code] section
Deleting setup.exe from output directory
Creating setup files
   Compressing: C:\test\cam\Samples\cam\bin\Release\cam.exe
   Compressing Setup program executable
   Updating version info

Warning: Setting the [Setup] section "OutputBaseFileName" to "setup" is not recommended, all executables named "setup.exe" are shimmed by Windows application compatibility to load additional DLLs, such as version.dll. These DLLs are loaded unsafely by Windows and can be hijacked. Use a different name, for example "mysetup".
*** Finished.  [9:57:56 PM, 00:00.797 elapsed]

Run Log

[21:50:15.323]   *** Setup started
[21:50:17.630]   Setup version: Inno Setup version 5.5.9 (a)
[21:50:17.633]   Original Setup EXE: C:\Users\tpt\Desktop\setup.exe
[21:50:17.636]   Setup command line: /SL5="$12059C,84663,57856,C:\Users\tpt\Desktop\setup.exe" /SPAWNWND=$11066E /NOTIFYWND=$200720 /DEBUGWND=$706F2 
[21:50:17.638]   Windows version: 10.0.16299  (NT platform: Yes)
[21:50:17.640]   64-bit Windows: Yes
[21:50:17.642]   Processor architecture: x64
[21:50:17.644]   User privileges: Administrative
[21:50:17.648]   64-bit install mode: No
[21:50:17.656]   Created temporary directory: C:\Users\tpt\AppData\Local\Temp\is-DI6BO.tmp
[21:50:20.137]   Starting the installation process.
[21:50:20.146]   Directory for uninstall files: C:\Program Files (x86)\Stackoverflow.Camera
[21:50:20.150]   Will append to existing uninstall log: C:\Program Files (x86)\Stackoverflow.Camera\unins000.dat
[21:50:20.158]   -- File entry --
[21:50:20.163]   Dest filename: C:\Program Files (x86)\Stackoverflow.Camera\unins000.exe
[21:50:20.171]   Time stamp of our file: 2018-03-15 21:50:17.512
[21:50:20.176]   Dest file exists.
[21:50:20.184]   Time stamp of existing file: 2018-03-15 21:49:54.524
[21:50:20.190]   Version of our file: 51.52.0.0
[21:50:20.196]   Version of existing file: 51.52.0.0
[21:50:20.201]   Installing the file.
[21:50:20.230]   Uninstaller requires administrator: Yes
[21:50:20.236]   Leaving temporary file in place for now.
[21:50:20.247]   -- File entry --
[21:50:20.253]   Dest filename: C:\Program Files (x86)\Stackoverflow.Camera\cam.exe
[21:50:20.259]   Time stamp of our file: 2018-02-26 12:29:56.000
[21:50:20.264]   Installing the file.
[21:50:20.288]   Successfully installed the file.
[21:50:20.294]   Setting permissions on file: C:\Program Files (x86)\Stackoverflow.Camera\cam.exe
[21:50:20.308]   -- Icon entry --
[21:50:20.313]   Dest filename: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Stackoverflow.Camera\Stackoverflow.Camera.lnk
[21:50:20.321]   Creating the icon.
[21:50:20.382]   Successfully created the icon.
[21:50:20.441]   Installation process succeeded.
[21:50:20.461]   -- Run entry --
[21:50:20.467]   Run as: Current user
[21:50:20.472]   Type: Exec
[21:50:20.478]   Filename: C:\Program Files (x86)\Stackoverflow.Camera\cam.exe
[21:50:28.061]   Process exit code: 255
[21:50:28.077]   Need to restart Windows? No
[21:50:29.247]   Deinitializing Setup.
[21:50:29.368]   *** Setup exit code: 0

As you can see in your log, only one icon was created:

[21:50:20.308]   -- Icon entry --
[21:50:20.313]   Dest filename: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Stackoverflow.Camera\Stackoverflow.Camera.lnk
[21:50:20.321]   Creating the icon.
[21:50:20.382]   Successfully created the icon.
[21:50:20.441]   Installation process succeeded.

The {group} constant relates to the Start Menu . In your comments you asked:

It looks like my code created a shortcut icon but without hotkey on it

That is correct. The icon in question is:

Name: "{group}\Stackoverflow.Camera"; Filename: "{app}\cam.exe"

It has no hot key. The other two are associated with a task . Specifically desktopicon . The help for tasks states:

This section is optional. It defines all of the user-customizable tasks Setup will perform during installation. These tasks appear as check boxes and radio buttons on the Select Additional Tasks wizard page .

By itself a task does nothing: it needs to be 'linked' to other installation entries.

You have linked it. So I am assuming that you are not ticking the task on the window during installation and that this is why those two icons are not created. Example:

任务窗口


As a side comment, did you see the warning about the name of your installer?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM