5

I am using Electron Builder to build an Electron app. I would like the executable to have a product version that is different from the package.json version.

This is what the build instruction in package.json looks like:

"build": {
    "appId": "myAppId",
    "productName": "My App",
    "copyright": "Copyright (C) 2022 My Company",
    "artifactName": "My App.exe",
    "directories": {
        "output": "dist/My App"
    },
    "buildVersion": "1.0.0.1"
},

I thought that buildVersion would update the product version, but when I look at the details of the .exe file, the product version has remained the same as the version number in package.json (1.0.0):

App details

How can I solve this?


EDIT: As a workaround, I downloaded this package, called verpatch, and I used its executable to change the product version of my application's .exe file:

.\verpatch.exe "My App.exe" /va "1.0.0.1" /pv "1.0.0.1" /s copyright "Copyright (C) 2022 My Company" /s description "My App's Description" /s product "My App"

It would be nice, however, to be able to use Electron Builder for this, instead of an external package.

notexactly
  • 918
  • 1
  • 5
  • 21
  • 4
    There's a way to override the product version, but it only works if the version is consist of 3 numbers. You can try adding `extraMetadata` parameter to electron-builder configuration which will inject properties to package.json. For example: `"extraMetadata": { "version": "2.0.0" }` – Jonathan Tsai Apr 25 '22 at 09:29
  • @JonathanTsai your answer has to be massively upvoted, since it's so hard to find this simple info! – DFuse Jul 19 '22 at 23:36

0 Answers0