在 Inno Setup "Portable mode" 中取消选择开始菜单和桌面图标的创建

Deselect creation of start menu and desktop icons in "Portable mode" in Inno Setup

我在[Tasks]

下有以下内容
[Tasks]
Name: "desktopicon"; Description: "Create a Desktop shortcut";
Name: "startmenu"; Description: "Create a Start Menu entry";
Name: "portablemode"; Description: "Portable Mode"; Flags: unchecked

及以下[Setup]

Uninstallable=not WizardIsTaskSelected('portablemode')

我希望在用户选择 portablemode 时取消选择 desktopiconstartmenu 任务,因为这些选项在 portablemode 安装配置下没有用:

如果有更简洁的方法来做到这一点,我也很感兴趣。

有两个 setup types"Full installation""Portable mode" 怎么样?并仅允许 "Full installation" 类型的图标任务?

对于Uninstallable,使用WizardIsComponentSelected

[Setup]
Uninstallable=WizardIsComponentSelected('full')

[Types]
Name: "full"; Description: "Full installation"
Name: "portable"; Description: "Portable mode"

[Components]
Name: "full"; Description: "full"; Types: full

[Tasks]
Name: "desktopicon"; Description: "Create a Desktop shortcut"; Components: full
Name: "startmenu"; Description: "Create a Start Menu entry"; Components: full