Skip to content

Commit

Permalink
fix(msi): remove MSI option iconId
Browse files Browse the repository at this point in the history
Also change the fallback value for generated MSI Ids to a unique string for the product.

BREAKING CHANGE: remove MSI option `iconId`
  • Loading branch information
aplum committed Jan 12, 2022
1 parent baf6127 commit e3fafcf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/serious-peas-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"app-builder-lib": major
---

BREAKING CHANGE: remove MSI option `iconId`
5 changes: 0 additions & 5 deletions packages/app-builder-lib/src/options/MsiOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,4 @@ export interface MsiOptions extends CommonWindowsInstallerConfiguration, TargetS
* Any additional arguments to be passed to the WiX installer compiler, such as `["-ext", "WixUtilExtension"]`
*/
readonly additionalWixArgs?: Array<string> | null

/**
* The [shortcut iconId](https://wixtoolset.org/documentation/manual/v4/reference/wxs/shortcut/). Optional, by default generated using app file name.
*/
readonly iconId?: string
}
10 changes: 7 additions & 3 deletions packages/app-builder-lib/src/targets/MsiTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,15 @@ export default class MsiTarget extends Target {
*/
private get productMsiIdPrefix() {
const sanitizedId = this.packager.appInfo.productFilename.replace(/[^\w.]/g, "").replace(/^[^A-Za-z_]+/, "")
return sanitizedId.length > 0 ? sanitizedId : "ElectronApp"
return sanitizedId.length > 0 ? sanitizedId : "App" + this.upgradeCode.replace(/-/g, "")
}

private get iconId() {
return this.options.iconId ?? `${this.productMsiIdPrefix}Icon.exe`
return `${this.productMsiIdPrefix}Icon.exe`
}

private get upgradeCode(): string {
return (this.options.upgradeCode || UUID.v5(this.packager.appInfo.id, ELECTRON_BUILDER_UPGRADE_CODE_NS_UUID)).toUpperCase()
}

async build(appOutDir: string, arch: Arch) {
Expand Down Expand Up @@ -178,7 +182,7 @@ export default class MsiTarget extends Target {
compressionLevel: compression === "store" ? "none" : "high",
version: appInfo.getVersionInWeirdWindowsForm(),
productName: appInfo.productName,
upgradeCode: (options.upgradeCode || UUID.v5(appInfo.id, ELECTRON_BUILDER_UPGRADE_CODE_NS_UUID)).toUpperCase(),
upgradeCode: this.upgradeCode,
manufacturer: companyName || appInfo.productName,
appDescription: appInfo.description,
// https://stackoverflow.com/questions/1929038/compilation-error-ice80-the-64bitcomponent-uses-32bitdirectory
Expand Down

0 comments on commit e3fafcf

Please sign in to comment.