So everything is working fine on electron-builder 20.5.1 then I decide to upgrade to version 20.13.4. Build the app and running as development is fine but when I build the app and open it is display the dialog message below. I'm also checking in Event Viewer and got this line.
Activation context generation failed for "pathToApp\app.exe".Error in manifest or policy file "pathToApp\app.exe" on line 0. Invalid Xml syntax. Does this also relate to #2934?

[UPDATE]: I try to lower the version, but it is not working since version 20.6.0.
package.json
{
"resolutions": {
"webpack-sources": "1.1.0"
},
"electronWebpack": {
"renderer": {
"webpackConfig": "webpack.renderer.additions.js"
}
},
"dependencies": {
"electron-store": "^1.3.0",
"material-ui": "^0.20.0",
"react": "^16.3.2",
"react-dom": "^16.3.2",
"react-router-dom": "^4.2.2",
"source-map-support": "^0.5.6",
"typeface-roboto": "^0.0.54"
},
"devDependencies": {
"electron": "^2.0.1",
"electron-builder": "^20.13.4",
"electron-webpack": "^2.1.1",
"electron-webpack-ts": "^2.0.2",
"tslint": "^5.9.1",
"tslint-react": "^3.5.1",
"typescript": "^2.8.3",
"webpack": "^4.8.3"
},
"build": {
"productName": "MyApp",
"compression": "maximum",
"forceCodeSigning": false,
"asar": true,
"win": {
"icon": "resources/icon/icon.ico",
"requestedExecutionLevel": "highestAvailable"
}
}
}
I doubt that it is regression. Please attach your app (or send me privately using email/slack).
+1
+1, having the same issue
+1
By the error message, it seems that electron-builder is referencing the .exe file itself as the manifest. I've extracted the manifest from the .exe file, and it's fully valid XML.
+1
We have a similar problem.
As soon as we add:
"build": {
"win": {
"requestedExecutionLevel": "highestAvailable"
}
},
we can't even run the app anymore. Installer works fine, but app can't be started.
Does anybody know how to get it to work?
I had to downgrade to 20.4.1, the issue appears to be in 20.5.1 onward
Thank you so much. It works perfectly now!
+1;After many attempts, I am sure it can't run since version 20.6.0.
Why is this issue being ignored? Somebody set the label "reply needed", but then ignores all replies?
Right now for me clear that is not electron-builder regression or bug. I need to fix rcedit/signtool and it requires quite a lot of time and patience (because Windows). Because it is not default settings, it is not fixed in a short term. Sorry, it is opensource project. If you need it for company — you can contact me to discuss about donation.
@MasterGberry done all investigation (and results are depressing, thanks MS).
Had to downgrade back down to 19.53.6 in order to do anything. Hope this gets resolved sometime in the near future.
It works just fine with version 20.4.1, so shouldn't it be fairly simple to compare changes between 20.4.1 and the most recent version (only looking at relevant changes, of course) and then fixing it?
@reFX-Mike It was done by @mastergberry Problem in a new signtool version from MS (most likely). I cannot downgrade it because it will affect other users (that uses default).
Unless the MS sign tool is part of this repository, what you claim is impossible.
Also we don’t use any code-signing for our project, yet. We’re strictly setting only the “requireAdministrator” flag for the manifest.
@reFX-Mike So, you don't code sign your app, right?
@develar that is correct. Everything is default except the “requireAdministrator” setting.
I have the same issue. Downgraded to 19.53.6 for now.
Any progress on this? I have the same error. And it takes much work to downgrade.
Tagging @develar as it appears this was fixed upstream https://github.com/electron/rcedit/pull/78 in 1.1.1
I have not had time to test it myself yet.
Test on [email protected], not worked. @mastergberry
+1; Have downgraded to 20.4.1 but am running into NSIS problems now. I presume they'd fix themselves with a newer electron-builder version.
Edit: Temporarily, I am trying to work on latest version without specifying "requestedExecutionLevel": "requireAdministrator", but am concerned.
On version 20.28.4, adding signAndEditExecutable seems to solve the issue:
"win": {
"requestedExecutionLevel": "requireAdministrator",
"signAndEditExecutable": false
}
But this seems to break the requestedExecutionLevel of the packaged app, it does not prompt for elevated privileges anymore
I have a same issue, so sad
The manifest file is started with BOM which should be removed.
I have tried to extract the manifest file, remove the bom, update manifest file, but not worked finally and no error occured.
Some code like:
const { execSync } = require('child_process')
const pkg = require('../package.json')
const mtPath = path.join(__dirname, 'mt.exe')
const exeFilePath = path.join(__dirname, `../build/app-${pkg.version}.exe`)
console.log('Start to extract manifest')
execSync(`${mtPath} -inputresource:${exeFilePath};#1 -out:scripts/manifest.old.xml`)
console.log('Start to remove bom')
require('./removeBom')
console.log('Start to pack the new manifest into exe file')
execSync(`${mtPath} -manifest scripts/manifest.xml -outputresource:${exeFilePath};#1`)
console.log('Done')
Windows EventViewer ->
Activation context generation failed for "F:Projects........exe".Error in manifest or policy file "F:Projects........exe" on line 0. Invalid Xml syntax.
@develar It seems pretty clear that someone is writing a BOM at the beginning of the manifest. This is not supported and causes the manifest to be invalid. Shouldn't it be trivial to remove that?
@reFX-Mike Please try 20.31.0, possibly bug is fixed in latest version of rcedit that bundled now.
OK, works fine now with 20.31.0. Isn't the latest official only 20.29.0? Where is 20.31.0 coming from?
We are waiting for the next bug 😄
On v20.31.0 not found any bug-fix resolve about "requestedExecutionLevel": "requireAdministrator"
Where is 20.31.0 coming from?
https://github.com/electron-userland/electron-builder/releases/tag/v20.31.0
Great, so, I will close issue, thanks for confirmation.
@develar 20.31.0 seems to pack files into asar file and I'm using api to pack.
files: ['dist/bundled/**/*']
It works for cli mode.
Most helpful comment
I had to downgrade to 20.4.1, the issue appears to be in 20.5.1 onward