mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-18 18:09:30 +08:00
59 lines
1.5 KiB
Plaintext
59 lines
1.5 KiB
Plaintext
# NSIS 安装程序
|
||
|
||
```mdx-code-block
|
||
<p style={{ "text-align": "center" }}>
|
||
<img
|
||
src={require("@site/static/img/nsis.webp").default}
|
||
style={{ "max-width": "50%" }}
|
||
/>
|
||
<br />
|
||
</p>
|
||
```
|
||
|
||
Wails 支持使用 [NSIS 安装程序](https://nsis.sourceforge.io/) 生成 Windows 安装程序。
|
||
|
||
## 安装 NSIS
|
||
|
||
### Windows
|
||
|
||
安装程序可在 [NSIS 下载页面](https://nsis.sourceforge.io/Download) 上找到。
|
||
|
||
如果您使用 chocolatey 包管理器,请运行以下脚本:
|
||
|
||
```
|
||
choco install nsis
|
||
```
|
||
|
||
如果手动安装 NSIS,则需要将 NSIS 安装目录中包含 `makensis.exe` 的 *Bin* 目录添加到 PATH 中。 [这是](https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/) 一个关于如何在 Windows 上添加到 PATH 的好教程。
|
||
|
||
### Linux
|
||
|
||
应该可以通过您的发行版的软件包管理器获得 `nsis` 包。
|
||
|
||
### MacOS
|
||
|
||
NSIS 可通 homebrew 安装:`brew install nsis`。
|
||
|
||
## 生成安装程序
|
||
|
||
创建新项目时,Wails 会在 `build/windows/installer` 中生成 NSIS 配置文件。 从 `installer/info.json` 读取配置数据,并配置为使用项目的 `wails.json` 信息部分:
|
||
|
||
```json
|
||
// ...
|
||
"Info": {
|
||
"companyName": "My Company Name",
|
||
"productName": "Wails Vite",
|
||
"productVersion": "1.0.0",
|
||
"copyright": "Copyright.........",
|
||
"comments": "Built using Wails (https://wails.io)"
|
||
},
|
||
```
|
||
|
||
要为您的应用程序生成安装程序,请使用 `wails build` 的 `-nsis` 标志:
|
||
|
||
```
|
||
wails build -nsis
|
||
```
|
||
|
||
现在可用安装程序将生成在 `build/bin` 目录中。
|