首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >APPXBUNDLE中的包APPX

APPXBUNDLE中的包APPX
EN

Stack Overflow用户
提问于 2019-03-21 09:08:47
回答 4查看 2.3K关注 0票数 1

我现在有一个UWP应用程序提交到Windows商店,现在我想发布一个更新。这个更新是基于电子,所以它不再是一个UWP应用程序。

我只想将电子应用程序提交到Windows,但我收到了以下错误消息: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.

电子应用程序与electron-builder一起打包,产生的文件是一个appx文件。以前,我用Visual打包了这个应用程序,结果文件是一个appxbundle

根据此错误消息,我必须提交一个.msixbundle.appxbundle文件。我可以创建一个包含电子.appx文件的.appx,然后将应用程序提交到Windows吗?

谢谢

EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2020-08-11 09:00:32

这是我自己问题的承诺答案。

正如我已经提到的,您必须坚持最初将应用程序提交到Microsoft的包格式。所以.appxbundle在我的案子里。

我使用的是electron-builder,它释放出一个.appx,然后使用afterAllArtifactBuildHook将其打包成一个.appxbundle

这是afterAllArtifactBuildHook.js位于我的电子项目的build/hooks文件夹中。它自动利用来自electron-builder的已经缓存的electron-builder工具,从而确保一切匹配。

.appx备注:这是面向Note和功能并行的桌面安装,Windows 10已经安装了构建文件

代码语言:javascript
复制
var path = require("path"),
    fs = require("fs"),
    glob = require("glob"),
    childProcess = require('child_process');

exports.default = function(buildResult) {
    buildResult.artifactPaths.forEach(function(appxPath) {
        if (appxPath.endsWith(".appx")) {
            convertAppx2AppxBundle(appxPath);
        }
    });
};

/**
 * Converts a Unix Path to a Windows conforming path by replacing any "/" with "\"
 * @return {string}
 */
String.prototype.windowsify = function windowsify() {
    return this.replace(/\//g, "\\");
}

/**
 * Converts the given appx to an appxbundle used for Windows Store submission
 * @note This function utalizes the parallels desktop tool "prlctl" to execute windows commands via macOS
 * @param appxPath
 */
function convertAppx2AppxBundle(appxPath) {
    try {
        console.log("Converting Appx to Appxbundle...")
        // We'll use electron-builder's winCodeSign tools which are conveniently already available in the following dir
        var electronBuilderDir = path.join(process.env.HOME, "Library/Caches/electron-builder"), // Don't use "~" it will just not work, trust me...
            // Will use the first matching windowsCodeSigning path as we may have multiple versions installed
            makeAppX = glob.sync(path.join(electronBuilderDir, "winCodeSign", "winCodeSign-*", "windows-10", "x64", "makeappx.exe"))[0],
            appxBundleMapFile = // This file is required by the makeappx.exe to generate the appxbundle
                '[Files]\n' +
                '"\\\\Mac\\AllFiles' + appxPath.replace(/\//g, "\\") + '"\t\t"Loxone.appx"';

        // Save the generated AppxBundle.map file to the filesystem to make it available for the Windows VM
        fs.writeFileSync(path.join(__dirname, "..", "AppxBundle.map"), appxBundleMapFile, { flag: "w" });

        var prlctlArgs = [
            'exec',
            '"Windows 10"', // the name of the specific Windows VM
            '--current-user', // We want to execute the following command with the current user
            // From this point on its the default Windows CLI command for converting an .appx to an .apppxbundle
            // Its important to know that these parts must conform to the Windows style, hence the windowsify function
            // We also need to use double quotation for the network shares due to how childProcess.execSync works...
            '"\\\\\\Mac\\AllFiles' + makeAppX.windowsify() + '"',
            'bundle',
            '/f',
            '"\\\\\\Mac\\AllFiles' + (__dirname.replace("/hooks", "") + "/AppxBundle.map").windowsify() + '"',
            '/p',
            '"\\\\\\Mac\\AllFiles' + appxPath.windowsify() + 'bundle"',
            '/o'
        ];
        // Now just execute the command to convert the appx to an appxbundle
        childProcess.execSync('prlctl ' + prlctlArgs.join(" "), { stdio: 'inherit' });
        console.log("Done converting Appx to Appxbundle");
    } catch (e) {
        console.warn("Couldn't convert appx two appxbundle!");
        console.error(e);
    }
}
票数 1
EN

Stack Overflow用户

发布于 2019-03-21 09:53:24

是的,您可以这样做,这里是来自MSFT的一篇循序渐进的文章,展示了如何为现有的m6/appx包生成一个MSIX包。

票数 1
EN

Stack Overflow用户

发布于 2022-10-09 16:44:50

用于更新现有appbundle的步骤,

  1. 构建您的APPX文件
  2. 创建一个bundle.txt文件 文件".\release_1.0.0.appx“"release_1.0.0.appx”
  3. 如果安装了VS2022,则打开x64_x86交叉工具命令提示符
  4. 更改到APPX文件所在的目录。
  5. 执行命令, /v /o /bv 1.0.0.0 /f bundle.txt /p release_1.0.0.appxbundle
  6. 然后,您应该能够上传到developer.windows.com仪表板上。
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55276951

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档