electron-userland/electron-builder

Question - Build NSIS for both 32 and 64 bits

popod opened this issue ยท 20 comments

popod commented

With electron-builder v19.19.1, when I build for windows with defaults params build -w, I get a nsis installer who only works for 64 bits. Is it correct ?

In fact, I expected that by default, the nsis contain both 32 and 64 bits versions. What do you think to do this behaviour by default ?

And second, is there any way to define the build target arch for Windows only in the package.json ? Because, now I use build -wml --x64 --ia32 and it build 32 bits versions for linux too and I do not want that..

Thanks

"win": {
  "target": [
    {
      "target": "nsis",
      "arch": [
        "x64",
        "ia32"
      ]
    }
  ]
},
"linux": {
  "target": [
    {
      "target": "AppImage",
      "arch": [
        "x64"
      ]
    }
  ]
}

and use

$ build -wl
popod commented

@cawa-93 Thank you! I've missed the "arch" options.. But the linux part is not necessary. By default only arch x64 is build.

And what about setting by default arch x64 and ia32 when target is "nsis" for Windows build ?

What do you have in mind?
You can see #1314

when target is "nsis" for Windows build ?

Currently, platformSpecific is respected, but not targetSpecific. Feel free to file feature request.

popod commented

@develar I'm not sure that you have understand what I'm trying to say ^^

With electron-builder v19.19.1, when I build for windows with defaults params build -w, I get a nsis installer who only works on 64 bits systems. Is it correct ?

In fact, I expected that by default, the nsis contain both 32 and 64 bits versions. What do you think to set this by default ?

So, what do you think to change the current default build settings. And automatically build and include ia32 and x64 in nsis installer by default ?

Now to do this, we should do:

"win": {
  "target": [
    {
      "target": "nsis",
      "arch": [
        "x64",
        "ia32"
      ]
    }
  ]
},

But this would be more useful to only do that (I think all people who use nsis do that to support x64 and ia32 ?) :

"win": {
  "target": [
    "nsis"
  ]
},

I don't think that it is a good default. And ia32 must die.

popod commented

Yes, I think like you, but many users always run Windows with ia32.. :( So this will be more interesting for developper to support this by default.

But this is only a "question/proposal".. This is not a problem for me to add this 2 more lines in package.json to config what I want.

@popod I think you are wrong. Regardless of the choice of OS or target, a single approach to the default parameters should be maintained. It is not a good idea to build NSIS somehow differently

popod commented

@cawa-93 Okey, yes I understand. Thanks for reply ;)

(In case anyone else gets here from google)

It gives me the error configuration.win has an unknown property 'arch' with the above settings. I was able to build by using this in package.json instead:

"scripts": {
  "dist": "electron-builder --ia32 --x64 -w"
}

configuration.win has an unknown property 'arch'

Same. Shame.

It doesn't look like @cawa-93's configuration works anymore in v21.2.0, at least when using the programmatic API, what are we supposed to use now?

Can u solve problem ? @fabiospampinato

@Mhmetengineer I'm using electron-builder programmatically and I'm calling it like so:

builder.build ({
  ia32: true,
  x64: true,
  win: {
    target: [
      'dir',
      'nsis',
      'zip'
    ]
  }
})

โ†‘ Error has occurred
configuration has an unknown property 'x64'.

This worked fine
#1897 (comment)

if both architectures are built in, how can the user choose then? I'm on mac, trying to understand.
For me this does work to get both arch's:

"win": {
      "target": {
        "target": "nsis",
        "arch": [
          "ia32",
          "x64"
        ]
      },

I don't think that it is a good default. And ia32 must die.

Yes, but still today there exist problems with 64 bit that do not exist with 32bit.
A customer updated windows server version from 2012 to 2019, together with Citrix version I guess.
Now the x64 version does not render anymore (white screen opens, html not rendered), but with only --ia32, everything is fine.

So, @develar, yes, it should die, but the software should survive :)

(In case anyone else gets here from google)

It gives me the error configuration.win has an unknown property 'arch' with the above settings.

That's because It belongs inside the config property of rawConfig. You must've added it in the root of rawConfig.

โ†‘ Error has occurred
configuration has an unknown property 'x64'.

I think you must've done the opposite of above. Try it inside the the config.

It works:

"scripts": {
  "release-win": "electron-builder --win --publish always"
},
"build": {
  "win": {
    "artifactName": "${productName} Setup ${version} ${arch}.${ext}",
    "target": [
      {
        "target": "nsis",
        "arch": [
          "x64",
          "ia32"
        ]
      }
    ]
  }
}

For configuration.win has an unknown property 'arch' error, in my case (using electron-builder.yml, you have to type 2 "target"s, which looks like this:

win:
  target:
    target: nsis
    arch:
      - x64
      - ia32
  executableName: your-app-name
nsis:
  artifactName: ${name}-${version}-${arch}.${ext}
  shortcutName: ${productName}
  uninstallDisplayName: ${productName}
  createDesktopShortcut: always