关于 msstore-cli
msstore 是面向 Microsoft Store 开发者的跨平台命令行工具,用于发布和管理应用。它涵盖项目初始化、打包、提交、测试 flight 和渐进式发布,也支持自动化工作流。
主要功能
- 01配置 Partner Center 凭据
- 02初始化并打包项目
- 03发布并跟踪提交状态
- 04管理测试 flight 和渐进发布
- 05更新应用元数据
适用场景
- 01准备项目以提交到 Store
- 02通过 CI/CD 发布应用更新
- 03向 flight 组分发测试版本
- 04分阶段逐步推出版本
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ github/ awesome-copilot --skill msstore-cli安装后在 Claude Code 中输入/msstore-cli确认已加载。
详细介绍
Microsoft Store Developer CLI (msstore)
Microsoft Store Developer CLI(msstore)是一个跨平台命令行界面,用于在 Microsoft Store 中发布和管理应用。它可集成 Partner Center API,并支持针对各类应用的自动化发布工作流。
何时使用本技能
当你需要完成以下操作时,可使用本技能:
- 配置用于 API 访问的 Store 凭据
- 列出 Store 账户中的应用
- 检查提交状态
- 将提交发布到 Store
- 为 Store 提交打包应用
- 初始化用于 Store 发布的项目
- 管理包航班(Beta 测试)
- 设置用于自动化 Store 发布的 CI/CD 管道
- 管理提交的逐步推出
- 以编程方式更新提交元数据
先决条件
- Windows 10+、macOS 或 Linux
- .NET 9 Desktop Runtime(Windows)或 .NET 9 Runtime(macOS/Linux)
- 具有相应权限的 Partner Center 账户
- 具有 Partner Center API 访问权限的 Azure AD 应用注册
- 通过以下任一方式安装的 msstore CLI:
- Microsoft Store:下载
- WinGet:
winget install "Microsoft Store Developer CLI" - 手动:从 GitHub Releases 下载
Partner Center 设置
在使用 msstore 之前,你需要创建一个具有 Partner Center 访问权限的 Azure AD 应用:
- 转到 Partner Center
- 导航到 Account settings > User management > Azure AD applications
- 创建一个新应用,并记录 Tenant ID、Client ID 和 Client Secret
- 为该应用授予相应权限(Manager 或 Developer 角色)
核心命令参考
info - 打印配置
显示当前凭据配置。
msstore info
选项:
| 选项 | 描述 |
|---|---|
-v, --verbose | 打印详细输出 |
reconfigure - 配置凭据
配置或更新 Microsoft Store API 凭据。
msstore reconfigure [options]
选项:
| 选项 | 描述 |
|---|---|
-t, --tenantId | Azure AD Tenant ID |
-s, --sellerId | Partner Center Seller ID |
-c, --clientId | Azure AD Application Client ID |
-cs, --clientSecret | 用于身份验证的 Client Secret |
-ct, --certificateThumbprint | 证书指纹(作为客户端密钥的替代方案) |
-cfp, --certificateFilePath | 证书文件路径(作为客户端密钥的替代方案) |
-cp, --certificatePassword | 证书密码 |
--reset | 重置凭据,无需完整重新配置 |
示例:
# Configure with client secret
msstore reconfigure --tenantId $TENANT_ID --sellerId $SELLER_ID --clientId $CLIENT_ID --clientSecret $CLIENT_SECRET
# Configure with certificate
msstore reconfigure --tenantId $TENANT_ID --sellerId $SELLER_ID --clientId $CLIENT_ID --certificateFilePath ./cert.pfx --certificatePassword MyPassword
settings - CLI 设置
更改 Microsoft Store Developer CLI 的设置。
msstore settings [options]
选项:
| 选项 | 描述 |
|---|---|
-t, --enableTelemetry | 启用(true)或禁用(false)遥测 |
设置 Publisher Display Name
msstore settings setpdn <publisherDisplayName>
设置 init 命令的默认 Publisher Display Name。
apps - 应用管理
列出并获取应用信息。
列出应用
msstore apps list
列出 Partner Center 账户中的所有应用。
获取应用详情
msstore apps get <productId>
参数:
| 参数 | 描述 |
|---|---|
productId | Store 产品 ID(例如 9NBLGGH4R315) |
示例:
# Get details of a specific app
msstore apps get 9NBLGGH4R315
submission - 提交管理
管理 Store 提交。
| 子命令 | 描述 |
|---|---|
status | 获取提交状态 |
get | 获取提交元数据和包信息 |
getListingAssets | 获取提交的列表资产 |
updateMetadata | 更新提交元数据 |
poll | 轮询提交状态直至完成 |
publish | 发布提交 |
delete | 删除提交 |
获取提交状态
msstore submission status <productId>
获取提交详情
msstore submission get <productId>
更新元数据
msstore submission updateMetadata <productId> <metadata>
其中 <metadata> 是包含更新后元数据的 JSON 字符串。由于 JSON 包含 shell 会解释的字符(引号、花括号等),你必须对值进行适当的引号包裹和/或转义:
- Bash/Zsh:用单引号包裹 JSON,以便 shell 原样传递。
msstore submission updateMetadata 9NBLGGH4R315 '{"description":"My updated app"}' - PowerShell:使用单引号(或在双引号字符串中转义双引号)。
msstore submission updateMetadata 9NBLGGH4R315 '{"description":"My updated app"}' - cmd.exe:用反斜杠转义每个内部双引号。
msstore submission updateMetadata 9NBLGGH4R315 "{\"description\":\"My updated app\"}"
提示: 对于复杂或多行元数据,将 JSON 保存到文件并改为传递其内容,以避免引号问题:
msstore submission updateMetadata 9NBLGGH4R315 "$(cat metadata.json)"
选项:
| 选项 | 描述 |
|---|---|
-s, --skipInitialPolling | 跳过初始状态轮询 |
发布提交
msstore submission publish <productId>
轮询提交
msstore submission poll <productId>
持续轮询,直到提交状态为 PUBLISHED 或 FAILED。
删除提交
msstore submission delete <productId>
选项:
| 选项 | 描述 |
|---|---|
--no-confirm | 跳过确认提示 |
init - 为商店初始化项目
为 Microsoft Store 发布初始化项目。自动检测项目类型并配置商店标识。
msstore init <pathOrUrl> [options]
参数:
| 参数 | 描述 |
|---|---|
pathOrUrl | 项目目录路径或 PWA URL |
选项:
| 选项 | 描述 |
|---|---|
-n, --publisherDisplayName | 发布者显示名称 |
--package | 同时打包项目 |
--publish | 打包并发布(隐含 --package) |
-f, --flightId | 发布到指定的 flight |
-prp, --packageRolloutPercentage | 逐步推出百分比(0-100) |
-a, --arch | 架构:x86、x64、arm64 |
-o, --output | 包的输出目录 |
-ver, --version | 构建时使用的版本 |
支持的项目类型:
- Windows App SDK / WinUI 3
- UWP
- .NET MAUI
- Flutter
- Electron
- React Native for Desktop
- PWA(渐进式 Web 应用)
示例:
# Initialize WinUI project
msstore init ./my-winui-app
# Initialize PWA
msstore init https://contoso.com --output ./pwa-package
# Initialize and publish
msstore init ./my-app --publish
package - 为商店打包
为 Microsoft Store 提交打包应用程序。
msstore package <pathOrUrl> [options]
参数:
| 参数 | 描述 |
|---|---|
pathOrUrl | 项目目录路径或 PWA URL |
选项:
| 选项 | 描述 |
|---|---|
-o, --output | 包的输出目录 |
-a, --arch | 架构:x86、x64、arm64 |
-ver, --version | 包的版本 |
示例:
# Package for default architecture
msstore package ./my-app
# Package for multiple architectures
msstore package ./my-app --arch x64,arm64 --output ./packages
# Package with specific version
msstore package ./my-app --version 1.2.3.0
publish - 发布到商店
将应用程序发布到 Microsoft Store。
msstore publish <pathOrUrl> [options]
参数:
| 参数 | 描述 |
|---|---|
pathOrUrl | 项目目录路径或 PWA URL |
选项:
| 选项 | 描述 |
|---|---|
-i, --inputFile | 现有 .msix 或 .msixupload 文件的路径 |
-id, --appId | 应用程序 ID(如果尚未初始化) |
-nc, --noCommit | 将提交保持为草稿状态 |
-f, --flightId | 发布到指定的 flight |
-prp, --packageRolloutPercentage | 逐步推出百分比(0-100) |
示例:
# Publish project
msstore publish ./my-app
# Publish existing package
msstore publish ./my-app --inputFile ./packages/MyApp.msixupload
# Publish as draft
msstore publish ./my-app --noCommit
# Publish with gradual rollout
msstore publish ./my-app --packageRolloutPercentage 10
flights - 包 Flight 管理
管理包 flight(Beta 测试组)。
| 子命令 | 描述 |
|---|---|
list | 列出应用的所有 flight |
get | 获取 flight 详情 |
delete | 删除 flight |
create | 创建新 flight |
submission | 管理 flight 提交 |
列出 Flight
msstore flights list <productId>
获取 Flight 详情
msstore flights get <productId> <flightId>
创建 Flight
msstore flights create <productId> <friendlyName> --group-ids <group-ids>
选项:
| 选项 | 描述 |
|---|---|
-g, --group-ids | Flight 组 ID(逗号分隔) |
-r, --rank-higher-than | 排名高于此 ID 的 Flight ID |
删除 Flight
msstore flights delete <productId> <flightId>
Flight 提交
# Get flight submission
msstore flights submission get <productId> <flightId>
# Publish flight submission
msstore flights submission publish <productId> <flightId>
# Check flight submission status
msstore flights submission status <productId> <flightId>
# Poll flight submission
msstore flights submission poll <productId> <flightId>
# Delete flight submission
msstore flights submission delete <productId> <flightId>
Flight 推出管理
# Get rollout status
msstore flights submission rollout get <productId> <flightId>
# Update rollout percentage
msstore flights submission rollout update <productId> <flightId> <percentage>
# Halt rollout
msstore flights submission rollout halt <productId> <flightId>
# Finalize rollout (100%)
msstore flights submission rollout finalize <productId> <flightId>
常见工作流
工作流 1:首次商店设置
# 1. Install the CLI
winget install "Microsoft Store Developer CLI"
# 2. Configure credentials (get these from Partner Center)
msstore reconfigure --tenantId $TENANT_ID --sellerId $SELLER_ID --clientId $CLIENT_ID --clientSecret $CLIENT_SECRET
# 3. Verify configuration
msstore info
# 4. List your apps to confirm access
msstore apps list
工作流 2:初始化并发布新应用
# 1. Navigate to project
cd my-winui-app
# 2. Initialize for Store (creates/updates app identity)
msstore init .
# 3. Package the application
msstore package . --arch x64,arm64
# 4. Publish to Store
msstore publish .
# 5. Check submission status
msstore submission status <productId>
工作流 3:更新现有应用
# 1. Build your updated application
dotnet publish -c Release
# 2. Package and publish
msstore publish ./my-app
# Or publish from existing package
msstore publish ./my-app --inputFile ./artifacts/MyApp.msixupload
工作流 4:逐步推出
# 1. Publish with initial rollout percentage
msstore publish ./my-app --packageRolloutPercentage 10
# 2. Monitor and increase rollout
msstore submission poll <productId>
# 3. (After validation) Finalize to 100%
# This completes via Partner Center or submission update
工作流 5:通过 Flights 进行 Beta 测试
# 1. Create a flight group in Partner Center first
# Then create a flight
msstore flights create <productId> "Beta Testers" --group-ids "group-id-1,group-id-2"
# 2. Publish to the flight
msstore publish ./my-app --flightId <flightId>
# 3. Check flight submission status
msstore flights submission status <productId> <flightId>
# 4. After testing, publish to production
msstore publish ./my-app
工作流 6:CI/CD 流水线集成
# GitHub Actions example
name: Publish to Store
on:
release:
types: [published]
jobs:
publish:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Install msstore CLI
run: winget install "Microsoft Store Developer CLI" --accept-package-agreements --accept-source-agreements
- name: Configure Store credentials
run: |
msstore reconfigure --tenantId ${{ secrets.TENANT_ID }} --sellerId ${{ secrets.SELLER_ID }} --clientId ${{ secrets.CLIENT_ID }} --clientSecret ${{ secrets.CLIENT_SECRET }}
- name: Build application
run: dotnet publish -c Release
- name: Publish to Store
run: msstore publish ./src/MyApp
与 winapp CLI 集成
winapp CLI(v0.2.0+)通过 winapp store 子命令与 msstore 集成:
# These commands are equivalent:
msstore reconfigure --tenantId xxx --clientId xxx --clientSecret xxx
winapp store reconfigure --tenantId xxx --clientId xxx --clientSecret xxx
# List apps
msstore apps list
winapp store apps list
# Publish
msstore publish ./my-app
winapp store publish ./my-app
当你希望为打包和发布获得统一的命令行体验时,请使用 winapp store。
故障排除
| 问题 | 解决方案 |
|---|---|
| 身份验证失败 | 使用 msstore info 验证凭据;重新运行 msstore reconfigure |
| 找不到应用 | 确保产品 ID 正确;运行 msstore apps list 进行验证 |
| 权限不足 | 检查 Partner Center 中的 Azure AD 应用角色(需要 Manager 或 Developer) |
| 包验证失败 | 确保包符合 Store 要求;查看 Partner Center 了解详情 |
| 提交卡住 | 运行 msstore submission poll <productId> 检查状态 |
| 找不到 Flight | 使用 msstore flights list <productId> 验证 flight ID |
| 推出百分比无效 | 值必须介于 0 到 100 之间 |
| PWA 初始化失败 | 确保 URL 可公开访问,并具有有效的 Web 应用清单 |
环境变量
CLI 支持使用环境变量提供凭据:
| 变量 | 描述 |
|---|---|
MSSTORE_TENANT_ID | Azure AD 租户 ID |
MSSTORE_SELLER_ID | Partner Center 卖家 ID |
MSSTORE_CLIENT_ID | Azure AD 应用程序客户端 ID |
MSSTORE_CLIENT_SECRET | 客户端密钥 |