electron / electron/forge

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

Open
#4,247 1 comment 0 reactions 1 assignee Claimed by @erickzhao View on GitHub
bug maker/msix
Dominant language
TypeScript
Stars
7.1k
Forks
641
Avg merge
3d 1h
Merged PRs (30d)
30

Description

### Pre-flight checklist

- [x] I have read the [contribution documentation](https://github.com/electron/forge/blob/main/CONTRIBUTING.md) for this project.
- [x] I agree to follow the [code of conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project uses.
- [x] 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. (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`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.