电子生成器使用电子生成器创建MSI安装程序 [英] Electron create MSI installer using electron-builder

查看:79
本文介绍了电子生成器使用电子生成器创建MSI安装程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设法使用电子生成器为Windows创建了一个.exe安装程序,我在文档中指出了创建2 package.json的问题:





相反,我最终在C:\Users\UserHome\AppData\Local\electron文件夹,其安装程序如下所示。





有没有一种方法可以使用电子生成器安装真正的.msi安装程序,并将其内容放置在Program文件夹中。唯一有效的项目是这个 https://github.com/theodo/electron-boilerplate,但它使用的是旧版电子生成器。



在电子文档中,将 noMsi 设置为false,应该做到这一点...

  Squirrel.Windows应该创建一个MSI安装程序吗? 


解决方案

您实际上不需要安装MSI即可您的应用已安装到 Program Files 中。



如果您在nsis配置( oneClick )中禁用了一次单击,则提示用户是否执行单用户安装(在 AppData 中)或每台计算机(在 Program Files 中)。



如果不想让他们选择,可以将 perMachine 设置为false,这将仅允许安装到程序文件中:

  nsis:{
oneClick:false,
perMachine:false
},

我会亲自给他们选择,因为他们仍然可以在没有管理员权限的情况下安装!



在最新版本的 electron-builder 中,还有一个 allowToChangeInstallationDirectory 选项允许用户选择任何安装位置。


I managed to create an .exe installer for windows using electron builder, I create 2 package.json as pointed out in the docs :

https://github.com/electron-userland/electron-builder.

I ended up having a folder with a working .exe

"dist:win64": "./node_modules/.bin/build --platform win32 --arch x64"

The build section of my main package.json is

"build": {
    "app-bundle-id": "org.test.mytest",
    "app-category-type": "public.app-category.graphics-design",
    "osx": {
      "contents": [
        {
          "x": 410,
          "y": 150,
          "type": "link",
          "path": "/Applications"
        },
        {
          "x": 130,
          "y": 150,
          "type": "file"
        }
      ]
    },
    "win": {
      "title": "My awesome app",
      "version": "2.28.999.1",
      "noMsi": false,
      "authors": "Author"
    }
  }

Everything works fine, I have and .exe installer but no way to have an .msi installer that put the content in program files directory.

Instead I ended up with an installation in the C:\Users\UserHome\AppData\Local\electron folder with and installer like below.

Is there a way to have a real .msi installer using electron builder that put the content in the Program file folder. The only one project that worked is this one https://github.com/theodo/electron-boilerplate but it uses a former version of electron-builder.

In the electron doc setting the noMsi to false, should do the trick ...

Should Squirrel.Windows create an MSI installer?

解决方案

You don't actually need an MSI installed to get your app installed into Program Files.

If you disable one click in the nsis config (oneClick), the user is prompted whether to do the single user install (in AppData) or per machine (in Program Files).

If you don't want to give them the choice, you can set perMachine to false which will only allow install into Program Files:

"nsis": {
  "oneClick": false,
  "perMachine": false
},

I would personally leave them the option as they can still install without admin rights!

In the latest version of electron-builder there is also a allowToChangeInstallationDirectory option which allows the user to choose any install location.

这篇关于电子生成器使用电子生成器创建MSI安装程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆