inno setup 6 打包C# winform 程序安装包
注:
checkablealone "选中"意思
unchecked "非选中"意思
图标选择:IconFilename: "{app}\Images\SysIcon.ico"
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | #define MyAppName "LuoCore" #define MyAppVersion "1.5" #define MyAppPublisher "LuoCore" #define MyAppURL "https://www.luocore.com/" #define MyAppExeName "LuoCore.exe" #define MyAppAssocName MyAppName + "" #define MyAppAssocExt ".exe" #define MyAppAssocKey StringChange(MyAppAssocName, " ", "") + MyAppAssocExt [Setup] ; 注意:AppId 是应用程序唯一标识值。不要在安装程序中对其他应用程序使用相同的 AppId 值。 ;(要生成新的 GUID,请在 IDE 内单击“工具 | 生成 GUID)”。 AppId={{D58B98CC-LuoCore-123} AppName={#MyAppName} AppVersion={#MyAppVersion} AppPublisher={#MyAppPublisher} AppPublisherURL={#MyAppURL} AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} DefaultDirName={autopf}\{#MyAppName} ChangesAssociations=yes DisableProgramGroupPage=yes ; 取消下列注释行,以在非管理员安装模式下运行(仅为当前用户安装。) ;PrivilegesRequired=lowest OutputDir=盘符:\路径\Inno Setup 6\编辑宏 OutputBaseFilename=LuoCore安装包名称_setup SetupIconFile=盘符:\路径\Inno Setup 6\编辑宏\LuoCore\Images\SysIcon.ico Compression=lzma SolidCompression=yes WizardStyle=modern [Languages] Name: "english" ; MessagesFile: "compiler:Default.isl" Name: "chinesesimplified" ; MessagesFile: "compiler:Languages\ChineseSimplified.isl" Name: "chinesetraditional" ; MessagesFile: "compiler:Languages\ChineseTraditional.isl" [Tasks] Name: "desktopicon" ; Description: "{cm:CreateDesktopIcon}" ; GroupDescription: "{cm:AdditionalIcons}" ; Flags: checkablealone [Files] Source: "盘符:\路径\Inno Setup 6\编辑宏\LuoCore\{#MyAppExeName}" ; DestDir: "{app}" ; Flags: ignoreversion Source: "盘符:\路径\Inno Setup 6\编辑宏\LuoCore\*" ; DestDir: "{app}" ; Flags: ignoreversion recursesubdirs createallsubdirs ; 注意: 在任何共享系统文件上不要使用 “Flags: ignoreversion” [Registry] Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt}\OpenWithProgids" ; ValueType: string ; ValueName: "{#MyAppAssocKey}" ; ValueData: "" ; Flags: uninsdeletevalue Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}" ; ValueType: string ; ValueName: "" ; ValueData: "{#MyAppAssocName}" ; Flags: uninsdeletekey Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\DefaultIcon" ; ValueType: string ; ValueName: "" ; ValueData: "{app}\{#MyAppExeName},0" Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\shell\open\command" ; ValueType: string ; ValueName: "" ; ValueData: "" "{app}\{#MyAppExeName}" " " "%1" "" Root: HKA; Subkey: "Software\Classes\Applications\{#MyAppExeName}\SupportedTypes" ; ValueType: string ; ValueName: ".myp" ; ValueData: "" [Icons] Name: "{autoprograms}\{#MyAppName}" ; Filename: "{app}\{#MyAppExeName}" ; IconFilename: "{app}\Images\SysIcon.ico" Name: "{autodesktop}\{#MyAppName}" ; Filename: "{app}\{#MyAppExeName}" ; Tasks: desktopicon;IconFilename: "{app}\Images\SysIcon.ico" [Run] Filename: "{app}\{#MyAppExeName}" ; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}" ; Flags: nowait postinstall skipifsilent |
2024-10-10-完善了控制面板卸载程序图标不显示问题
; 脚本由 Inno Setup 脚本向导生成! ; 有关创建 Inno Setup 脚本文件的详细资料请查阅帮助文档! ; 定义应用程序名称 #define MyAppName "LuoCore" ; 定义应用程序版本 #define MyAppVersion "2" ; 定义应用程序发布公司 #define MyAppPublisher "LuoCore科技有限公司" ; 定义应用程序官方网站 #define MyAppURL "https://www.LuoCore.com/" ; 定义应用程序的主执行文件名 #define MyAppExeName "LuoCore.exe" ; 定义文件关联名称 #define MyAppAssocName MyAppName + " 文件" ; 定义文件扩展名 #define MyAppAssocExt ".exe" ; 定义文件关联的注册键 #define MyAppAssocKey StringChange(MyAppAssocName, " ", "") + MyAppAssocExt [Setup] ; 应用程序唯一识别 ID AppId={{写自己得Code} ; 应用程序名称 AppName={#MyAppName} ; 应用程序版本 AppVersion={#MyAppVersion} ; 应用程序发布公司 AppPublisher={#MyAppPublisher} ; 应用程序发布网页 AppPublisherURL={#MyAppURL} ; 应用程序支持网页 AppSupportURL={#MyAppURL} ; 应用程序更新网页 AppUpdatesURL={#MyAppURL} ; 默认安装目录 DefaultDirName={autopf}\{#MyAppName} ; 更改文件关联 ChangesAssociations=yes ; 禁用程序组页面 DisableProgramGroupPage=yes ; 输出目录 OutputDir=B:\LuoCore\安装包 ; 输出安装包基文件名 OutputBaseFilename=LuoCore_Setup ; 安装程序图标 SetupIconFile=B:\LuoCore\Images\SysIcon.ico ; 压缩方式 Compression=lzma ; 是否采用整体压缩 SolidCompression=yes ; 向导样式 WizardStyle=modern ; 设置控制面板中程序图标 UninstallDisplayIcon={app}\Images\SysIcon.ico ; 设置控制面板中程序的名称 Uninstallable=yes UninstallDisplayName={#MyAppName} [Languages] ; 使用简体中文语言 Name: "chinesesimp"; MessagesFile: "compiler:Default.isl" [Tasks] ; 创建桌面图标任务 Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkablealone [Files] ; 主执行文件配置 Source: "B:\LuoCore\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion ; 其他文件配置 Source: "B:\LuoCore\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs ; 图标文件配置 Source: "B:\LuoCore\Images\SysIcon.ico"; DestDir: "{app}\Images"; Flags: ignoreversion [Registry] ; 文件类型关联的注册表设置 Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}"; ValueType: string; ValueName: ""; ValueData: "{#MyAppAssocName}"; Flags: uninsdeletekey ; 设置程序图标在控制面板中的显示 Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\Images\SysIcon.ico" ; 文件打开命令 Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""%1""" ; 支持的文件类型 Root: HKA; Subkey: "Software\Classes\Applications\{#MyAppExeName}\SupportedTypes"; ValueType: string; ValueName: ".myp"; ValueData: "" [Icons] ; 开始菜单图标配置 Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\Images\SysIcon.ico" ; 桌面图标配置 Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon; IconFilename: "{app}\Images\SysIcon.ico" ; 公共桌面图标配置 Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; WorkingDir: "{app}"; IconFilename: "{app}\Images\SysIcon.ico" [Run] ; 安装后自动运行主程序 Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构