electron-windows-store icon indicating copy to clipboard operation
electron-windows-store copied to clipboard

No support for creating a .appxbundle

Open jameshfisher opened this issue 4 years ago • 6 comments

When submitting my .appx file to the Microsoft Store, I get the error:

A previous submission for this app was released with a Windows 10 .msixbundle or .appxbundle. Subsequent submissions must continue to contain a Windows 10 .msixbundle or .appxbundle.

So producing an .appx, as electron-windows-store does, is not always sufficient for the Microsoft Store. We need to create a .appxbundle from this. But I don't see options for this in electron-windows-store API.

This answer provides some clues, but it's not very pretty. And it produces an unsigned .appxbundle, meaning I have to manually re-sign the .appxbundle it creates.

jameshfisher avatar Nov 06 '20 11:11 jameshfisher

I got this working. I'd be willing to submit a PR adding this support. However it seems like this repo is dead/unmaintained

jameshfisher avatar Nov 06 '20 11:11 jameshfisher

Here's the essence of my soln:


const convertToWindowsStore = require('electron-windows-store');
const electronWindowsStoreUtils = require('electron-windows-store/lib/utils');

const opts = { /* */ };

await convertToWindowsStore(opts);

// This is how electron-windows-store seems to behave
const appxPath = `${opts.outputDirectory}\\${opts.packageName}.appx`;

const APPXBUNDLE_FILEPATH = 'some\\output\\dir\\MyAppName.appxbundle';

const TMP_APPXBUNDLE_MAP_FILEPATH = 'some\\tmp\\dir\\AppxBundle.map';

// https://docs.microsoft.com/en-us/windows/msix/package/create-app-package-with-makeappx-tool#mapping-files
fs.writeFileSync(TMP_APPXBUNDLE_MAP_FILEPATH, [
    '[Files]',
    `"${appxPath}" "MyAppName.appx"`,  // Note: the filename within the .appxbundle seems to be unimportant?
    ].join("\n"));

// This makes an unsigned bundle ...
const makeappx = path.join(windowsKitPath, 'makeappx.exe');
await electronWindowsStoreUtils.executeChildProcess(makeappx, 
    ['bundle', '/f', TMP_APPXBUNDLE_MAP_FILEPATH, '/p', APPXBUNDLE_FILEPATH, '/o']);

// ... so we have to sign it with:
const signtool = path.join(windowsKitPath, 'signtool.exe');
await electronWindowsStoreUtils.executeChildProcess(signtool, 
    ['sign', '-f', opts.devCert, '-p', opts.certPass, '-fd', 'SHA256', '-v', APPXBUNDLE_FILEPATH]);

jameshfisher avatar Nov 06 '20 16:11 jameshfisher

@jameshfisher Why are you signing the application/bundle? It looks like it might not be signed for submission to the Store.

mahnunchik avatar Nov 19 '20 12:11 mahnunchik

I'm signing it for submission to the Microsoft Store, which requires a bundle signed with my Microsoft developer identity

jameshfisher avatar Nov 19 '20 14:11 jameshfisher

@jameshfisher I was able to submit not signed .appxbundle to Store.

@felixrieseberg is this project dead?

mahnunchik avatar Dec 21 '20 13:12 mahnunchik

@felixrieseberg could you please pay attention to this issue.

mahnunchik avatar Jan 14 '21 06:01 mahnunchik