Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No support for creating a .appxbundle #136

Open
jameshfisher opened this issue Nov 6, 2020 · 6 comments
Open

No support for creating a .appxbundle #136

jameshfisher opened this issue Nov 6, 2020 · 6 comments

Comments

@jameshfisher
Copy link

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
Copy link
Author

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
Copy link
Author

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]);

@mahnunchik
Copy link

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

@jameshfisher
Copy link
Author

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

@mahnunchik
Copy link

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

@felixrieseberg is this project dead?

@mahnunchik
Copy link

@felixrieseberg could you please pay attention to this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants