Skip to content
Tauri 中文网

Microsoft Store

Microsoft Store 是 Microsoft 运营的 Windows 应用商店。

🌐 Microsoft Store is the Windows app store operated by Microsoft.

本指南仅涵盖将 Windows 应用直接分发到 Microsoft Store 的详细信息。有关 Windows 安装程序分发选项和配置的更多信息,请参阅 [Windows 安装程序指南]。

🌐 This guide only covers details for distributing Windows Apps directly to the Microsoft Store. See the Windows Installer guide for more information on Windows installer distribution options and configurations.

🌐 Requirements

要在 Microsoft Store 发布应用,你必须拥有一个 Microsoft 账户,并以个人或公司身份[注册]为开发者。

🌐 To publish apps on the Microsoft Store you must have a Microsoft account and enroll as a developer either as an individual or as a company.

🌐 Changing App Icon

Tauri CLI 可以生成应用所需的所有图标,包括 Microsoft Store 图标。 使用 tauri icon 命令可以从单个 PNG 或 SVG 源生成应用图标:

🌐 The Tauri CLI can generate all icons your app needs, including Microsoft Store icons. Use the tauri icon command to generate app icons from a single PNG or SVG source:

npm run tauri icon /path/to/app-icon.png

🌐 Setting up

在你使用 Microsoft 账户注册为开发者后,你需要在 [应用和游戏] 页面注册你的应用。点击 New Product,选择 EXE or MSI app 并为你的应用预留一个唯一名称。

🌐 After you have enrolled as a developer with your Microsoft account you need to register your app in the Apps and Games page. Click New Product, select EXE or MSI app and reserve a unique name for your app.

🌐 Build and upload

目前 Tauri 仅生成 EXE 和 MSI 安装程序,因此你必须创建一个仅链接到解压应用的 Microsoft Store 应用。Microsoft 安装程序中链接的安装程序必须是离线的,[处理自动更新] 并且 [代码签名]。

🌐 Currently Tauri only generates EXE and MSI installers, so you must create a Microsoft Store application that only links to the unpacked application. The installer linked in the Microsoft Installer must be offline, handle auto-updates and be code signed.

有关更多信息,请参阅[官方发布文档]。

🌐 See the official publish documentation for more information.

🌐 Offline Installer

通过微软商店分发的 Windows 安装程序必须使用 [离线安装程序] Webview2 安装选项。

🌐 The Windows installer distributed through the Microsoft Store must use the Offline Installer Webview2 installation option.

要仅在为 Microsoft Store 打包时应用此安装程序配置,你可以定义单独的 Tauri 配置文件:

🌐 To only apply this installer configuration when bundling for Microsoft Store, you can define a separate Tauri configuration file:

"src-tauri/tauri.microsoftstore.conf.json
{
"bundle": {
"windows": {
"webviewInstallMode": {
"type": "offlineInstaller"
}
}
}
}

然后在为 Microsoft Store 打包 Tauri 应用时将该配置文件与主文件合并:

🌐 Then merge that config file with the main one when bundling your Tauri app for Microsoft Store:

npm run tauri build -- --no-bundle
npm run tauri bundle -- --config src-tauri/tauri.microsoftstore.conf.json

当设置你的 CI/CD 以将应用上传到 Microsoft Store,同时为你在应用商店之外分发的 Windows 安装程序拥有单独配置时,这尤其有用。

🌐 This is particularly useful when setting up your CI/CD to upload your app to the Microsoft Store while having a separate configuration for the Windows installer you distribute outside the app store.

🌐 Publisher

你的应用 [发布者] 名称不能与应用产品名称相同。

🌐 Your application publisher name cannot match the application product name.

如果未设置发布者配置值,Tauri 会从你的打包标识符的第二部分派生它。由于发布者名称不能与产品名称相同,以下配置是无效的:

🌐 If the publisher configuration value is not set, Tauri derives it from the second part of your bundle identifier. Since the publisher name cannot match the product name, the following configuration is invalid:

tauri.conf.json
{
"productName": "Example",
"identifier": "com.example.app"
}

在这种情况下,你可以单独定义 publisher 值来解决此冲突:

🌐 In this case you can define the publisher value separately to fix this conflict:

tauri.conf.json
{
"productName": "Example",
"identifier": "com.example.app",
"bundle": {
"publisher": "Example Inc."
}
}

🌐 Upload

在为 Microsoft Store 构建 Windows 安装程序之后,你可以将其上传到你选择的分发服务,并在 Microsoft Store 网站的应用页面中链接它。

🌐 After building the Windows installer for Microsoft Store, you can upload it to the distribution service of your choice and link it in your application page in the Microsoft Store website.


Tauri 中文网 - 粤ICP备13048890号
Nodejs.cn 旗下网站