nwjs 0.19打包exe

这篇博客介绍了如何利用Inno Setup打包nwjs 0.19.5-win-x64版本为exe应用程序。首先,下载nwjs及相关工具,然后将nwjs内容复制到指定目录,将代码压缩并改名,再将package.nw放入目录中。接着,使用Inno Setup创建脚本进行打包,最后通过ResHacker解决图标问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

首先0.12以后版本原因打包方式依赖内容都不同了。
这里我找到一个最简单快捷的方式

打包工具 Inno Setup
图标更改工具ResHacker(这里下载angusj.com)
1. 从下载nwjs
2. 这里我使用的是nwjs-v0.19.5-win-x64 或sdk版
3. 在D盘建立abc目录
4. 将nwjs-v0.19.5-win-x64内文件全部copy到abc文件夹下
5. 将代码用winrar压缩,然后修改扩展名为package.nw
6. 将package.nw拷贝到abc目录下(如下图)
这里写图片描述
7. 打开InnoSetup创建一个空的脚本
脚本信息如下

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

#define MyAppName "我的nw" ;name
#define MyAppVersion "0.1" ;版本
#define MyAppPublisher "mynw"
#define MyAppURL "mynw"
#define MyAppExeName "nwnw.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={{32361EF1-C625-43D4-ADA3-1F5EE62AE3A7}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DisableProgramGroupPage=yes
OutputDir=D:\abc\output ;安装包输出目录
OutputBaseFilename=setup ;//安装包名setup.exe
SetupIconFile=D:\xxx\xxx.ico ;//图标
Compression=lzma
SolidCompression=yes

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

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

[Files]
Source: "D:\abc\*"; DestDir: "{app}"; Flags: ignoreversion   ;拷贝所有nwjs支持文件
Source: "D:\abc\locales\*"; DestDir: "{app}\locales"; Flags: ignoreversion 


[Icons]
Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

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

[Registry]
Root: HKCR; SubKey: isMyNw; ValueData: "URL:isMyNw Protocol"; ValueType: string; Flags: CreateValueIfDoesntExist UninsDeleteKey;
Root: HKCR; SubKey: isMyNw; ValueName: "URL Protocol"; Flags: CreateValueIfDoesntExist; ValueType: string;
Root: HKCR; SubKey: isMyNw\DefaultIcon; ValueData: "{app}\{#MyAppExeName},1"; Flags: CreateValueIfDoesntExist; ValueType: string;
Root: HKCR; SubKey: isMyNw\shell\open\command; ValueData: "{app}\{#MyAppExeName} %1"; Flags: CreateValueIfDoesntExist; ValueType: string;

点击运行则开始打包,最后到output找到安装包即可

如遇到图标没有写入的问题
使用文章开头说到的图标替换工具即可

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值