mcpField
M
msstore-cli

msstore-cli

github.com/github云与 DevOps40.5k7.0k 次安装1 天前更新
代码仓库

关于 msstore-cli

msstore 是面向 Microsoft Store 开发者的跨平台命令行工具,用于发布和管理应用。它涵盖项目初始化、打包、提交、测试 flight 和渐进式发布,也支持自动化工作流。

主要功能

  1. 01配置 Partner Center 凭据
  2. 02初始化并打包项目
  3. 03发布并跟踪提交状态
  4. 04管理测试 flight 和渐进发布
  5. 05更新应用元数据

适用场景

  1. 01准备项目以提交到 Store
  2. 02通过 CI/CD 发布应用更新
  3. 03向 flight 组分发测试版本
  4. 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 应用:

  1. 转到 Partner Center
  2. 导航到 Account settings > User management > Azure AD applications
  3. 创建一个新应用,并记录 Tenant ID、Client ID 和 Client Secret
  4. 为该应用授予相应权限(Manager 或 Developer 角色)

核心命令参考

info - 打印配置

显示当前凭据配置。

msstore info

选项:

选项描述
-v, --verbose打印详细输出
reconfigure - 配置凭据

配置或更新 Microsoft Store API 凭据。

msstore reconfigure [options]

选项:

选项描述
-t, --tenantIdAzure AD Tenant ID
-s, --sellerIdPartner Center Seller ID
-c, --clientIdAzure 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>

参数:

参数描述
productIdStore 产品 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-idsFlight 组 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_IDAzure AD 租户 ID
MSSTORE_SELLER_IDPartner Center 卖家 ID
MSSTORE_CLIENT_IDAzure AD 应用程序客户端 ID
MSSTORE_CLIENT_SECRET客户端密钥

参考资料

评论

支持 Markdown