gpt4 book ai didi

windows - 如何从我的 Electron 应用程序中制作安装程序,类似于 vscode 安装设置?

转载 作者:行者123 更新时间:2023-12-03 12:28:30 28 4
gpt4 key购买 nike

我正在尝试为我的 Electron 应用程序进行安装设置。我已经尝试过 Electron 生成器和 Electron 打包器,它有效,但不是我所希望的。我想要一个类似于 vscode 的安装设置(我听说它是​​使用 electronjs 制作的),它是一个独立的安装程序,包含所有用户协议(protocol)、路径等。如何做到这一点?是否根据用户将其安装到哪个操作系统而有所不同?我现在只关注 Windows,因为我正在创建的应用程序仅适用于 Windows。

最佳答案

electron-builder你设置了"oneClick": false ?这将为您提供 PC 上的“安装向导”式安装程序。 oneClick 的默认值是真的,所以你必须明确地设置它。

来自 docs :

  • oneClick = true Boolean - Whether to create one-click installer or assisted.

  • perMachine = false Boolean - Whether to show install mode installer page (choice per-machine or per-user) for assisted installer. Or whether installation always per all users (per-machine).

  • If oneClick is true (default): Whether to install per all users (per-machine).

  • If oneClick is false and perMachine is true: no install mode installer page, always install per-machine.

  • If oneClick is false and perMachine is false (default): install mode installer page.

  • allowElevation = true Boolean - assisted installer only. Allow requesting for elevation. If false, user will have to restart
    installer with elevated permissions.

  • allowToChangeInstallationDirectory = false Boolean - assisted installer only. Whether to allow user to change installation
    directory.


在 OSX 上,使用 DMG格式,如果你指定一个许可证(也许还有“licenseButtons”JSON 文件——这对我有用)你会在 DMG 之前看到一个协议(protocol)对话框。坐骑。

来自 docs :

To add license to DMG, create file license_LANG_CODE.txt in the build resources. Multiple license files in different languages are supported — use lang postfix (e.g. _de, _ru)). For example, create files license_de.txt and license_en.txt in the build resources. If OS language is german, license_de.txt will be displayed. See map of language code to name.

You can also change the default button labels of the DMG by passing a json file named licenseButtons_LANG_CODE.json. The german file would be named: licenseButtons_de.json. The contain file should have the following format:


{
"lang": "English",
"agree": "Agree",
"disagree": "Disagree",
"print": "Print",
"save": "Save",
"description": "Here is my own description"
}

关于windows - 如何从我的 Electron 应用程序中制作安装程序,类似于 vscode 安装设置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55992878/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com