Skip to content

@electron-forge/maker-msix errors only shown in Event Viewer and name is overriden by productName in package.json #4247

@Emily1799

Description

@Emily1799

Pre-flight checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project uses.
  • I have searched the issue tracker for a bug that matches the one I want to file, without success.

Forge version

7.11.1

Electron version

40.6.0

Operating system

Windows 11

Last known working Forge version

No response

Expected behavior

I ran Electron Forge make with maker config very close to the example documentation code provided. It specifies a name without spaces. The displayable name of my app has spaces. I have a productName variable specified in the package.json that has those spaces.

I expect the example code to succeed, or at least fail with a helpful error message if the app name contains illegal characters. If that can't be done, the documentation should at least warn the user.

Actual behavior

❯ Making distributables
  ✖ Making a msix distributable for win32/x64
    › Failed running C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\makeappx.exe Exit Code: 1 See previous errors for details
◼ Running postMake hook

error: stderr of C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\makeappx.exe
[
    ""
  ]

An unhandled rejection has occurred inside Forge:
Error: Failed running C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\makeappx.exe Exit Code: 1 See previous errors for details
at ChildProcess.<anonymous> (C:\Users\MyUserName\work\my-short-app-name\node_modules\electron-windows-msix\lib\bin.js:30:31)
    at ChildProcess.emit (node:events:519:28)
    at ChildProcess.emit (node:domain:489:12)
    at ChildProcess._handle.onexit (node:internal/child_process:293:12)

If I go into the WIndows Event Viewer, under Microsoft-Windows-AppxPackaging/Operational, I can see that the real error is:

error 0xC00CE169: App manifest validation error: The app manifest must be valid as per schema: Line 10, Column 13, Reason: 'My Fancy App Name' violates pattern constraint of '[-.A-Za-z0-9]+'.
The attribute 'Name' with value 'My Fancy App Name' failed to parse.

Electron Forge should output some sort of helpful error in this case (or at least let the user know that there may be helpful information in the Windows Event Viewer)

Steps to reproduce

It seemed to be pulling the string from the productName variable in my package.json, and once I deleted that, it built. So specify a productName in the package.json that has spaces.

 makers: [ {
name: '@electron-forge/maker-msix',
      config: {
        manifestVariables: {
          publisher: 'MyCorp',
          name: `${packageJson.name}-${packageJson.version}${beta ? 'b' : ''}-win32`
        },
       // my signing stuff here
        }
      }
    },
   }]

Additional information

npx electron-forge make --targets @electron-forge/maker-msix

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions