Skip to content

Invalid product versions for NSIS when packaging in CI #2635

@DiedB

Description

@DiedB
  • Version: 20.1.1
  • Target: NSIS (Windows)

The product version (X.X.X.X) is given to NSIS as a command line variable called VIProductVersion. This build number is generated by the function versionInWeirdWindowsForm() (which can be found in packages/electron-builder-lib/src/appInfo.ts). To fill in the last digit, which is not present in Node, it uses the build number environment variable or 0 if this is not present. It is set as follows, in the same file:
this.buildNumber = process.env.BUILD_NUMBER || process.env.TRAVIS_BUILD_NUMBER || process.env.APPVEYOR_BUILD_NUMBER || process.env.CIRCLE_BUILD_NUM || process.env.BUILD_BUILDNUMBER
However, it is not checked whether this environment variable is actually numeric. In case of Visual Studio Team Services (and probably other CI providers as well), this variable is alphanumeric (resulting in 1.2.3.Build123 for example). When NSIS is started to create the installer package, an invalid build number is passed making it throw an error and stop packaging.

This problem should be handled by Electron Builder. I suggest detecting an alphanumeric value and setting the build number to 0 if this is the case, preventing errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions