Winapp,Windows 应用开发 CLI
Winapp, the Windows App Development CLI

原始链接: https://blogs.windows.com/windowsdeveloper/2026/01/22/announcing-winapp-the-windows-app-development-cli/

## Windows 应用开发 CLI:公共预览版 微软发布了 **Windows 应用开发 CLI (winapp)** 的公共预览版,这是一款新的开源工具,旨在简化使用 Electron、C++、.NET、Rust 和 Dart 等各种框架的 Windows 应用开发,即使*不在* Visual Studio 之外。 winapp CLI 简化了常见的复杂任务,例如 SDK 管理、清单创建、证书处理和打包。主要功能包括一键环境设置 (`winapp init`)、轻松添加 **包标识** 以调试现代 API(如 Windows AI),以及简化的 MSIX 打包 (`winapp pack`)。 特别为 **Electron 开发者** 提供,winapp 提供 npm 集成,用于搭建原生插件并注入包标识以实现无缝调试。它甚至为 LanguageModel 等 API 提供 NodeJS 投影。 本次预览旨在收集开发者反馈并塑造未来的开发方向。您可以通过 WinGet 或 npm 安装 winapp,并找到文档、指南和 GitHub 仓库以报告问题和贡献代码。 **开始使用:** [https://github.com/microsoft/winappcli](https://github.com/microsoft/winappcli)

相关文章

原文

We are excited to announce the public preview of the Windows App Development CLI (winapp), a new open-source command-line tool designed to simplify the development lifecycle for Windows applications across a wide range of frameworks and toolchains.

The winapp CLI is specifically tailored for cross-platform frameworks and developers working outside of Visual Studio or MSBuild. Whether you are a web developer building with Electron, a C++ veteran using CMake, or a .NET,  Rust or Dart developer building apps for Windows, the CLI can streamline the complexities of Windows development – from setting up your environment to packaging for distribution. This makes it significantly easier to access modern APIs – including Windows AI APIs, security features and shell integrations – directly from any toolchain.

Windows development often involves managing multiple SDKs, creating and editing multiple manifests, generating certificates and navigating intricate packaging requirements. The goal of this project is to unify these tasks into a single CLI, letting you focus on building great apps rather than fighting with configuration. While the CLI is still in its early days, and there are many Windows development scenarios still in the works, we’re sharing this public preview now to learn from real usage, gather feedback and feature requests, and focus our investments on the areas that matter most to developers.

Here is a look at what the winapp CLI can do for you.

🛠️ One-command environment setup

The initcommand bootstraps your entire workspace. It downloads the necessary SDK packages, generates projections (C++/WinRT to start), and configures your project for development. A process that previously required multiple error-prone manual steps is now a single CLI command that handles manifest and asset creation, certificate generation and dependency management, saving you from manually setting up your dev environment per project.

To get started, in the root of your project, run:

> winapp init

For projects shared across multiple machines or developers, use winapp restoreto recreate the exact environment state defined in your configuration. And for CI/CD environments, use the GitHub and Azure DevOps action to automatically install the CLI.

🚀 Package Identity for debugging

Many modern Windows APIs (like Windows AI APIs, Security, Notifications, MCP Hosts and more) require your application to have Package Identity. Traditionally, this meant you had to fully package and install your app just to test a single feature, requiring multiple manual and detailed configuration steps, slowing down your inner loop significantly.

With the winapp CLI, you can add package identity to your executable with a single command, allowing you to continue using the same developer loop for testing and debugging any code requiring Package Identity.

Simply run:

> winapp create-debug-identity my-app.exe

Visit our samples and guides for snippets on how to integrate this command in different toolchains for improved  debugging experience.

📜 Working with manifests and certificates

Creating a valid appxmanifest.xml and setting up a trusted development certificate are often stumbling blocks for new Windows developers. The winapp CLI automates this entirely with the init command as described above, but it also exposes commands to directly create and manage manifest and development certificates.

Generate a new manifest based on your project or executable, update image assets in your existing appxmanifest.xml from an existing logo, or create and install a self-signed development certificate with a single command. The CLI can optionally install the development certificate locally so you can test your packages without additional configuration.

For example, use this command to update all image assets referenced in your appxmanifest.xml from a provided image in the correct aspect ratios:

> winapp manifest update-assets C:\images\my-logo.png

Likewise, generating a development certificate that can be used for self-signing while sideloading and testing, you can use the following command:
> winapp cert generate

📦 Simplified MSIX packaging

When you are ready to ship, packaging your application as an MSIX is just one command away. The CLI handles the packing and signing process, producing a store-ready or sideload-ready package from your build output.
> winapp pack ./my-app-files --cert ./devcert.pfx

⚡ Electron integration

For Electron developers, we have packaged the CLI as a npm package and added commands to bridge the gap between Node.js and native Windows code. The CLI can scaffold C++ or C# native addons, pre-configured to access the Windows App SDK and Windows SDK. This makes it easier than ever to integrate high-performance native features or AI capabilities like Phi Silica directly into your Electron app.

We also simplify the debugging loop. With winapp node add-electron-debug-identity, you can inject Package Identity directly into your running Electron process. This allows you to test and debug APIs that require identity (like the Windows AI APIs) just by calling npm start . It even handles bootstrapping the Windows App SDK for you, so you can focus on your code, not the plumbing. Watch the video below to see all of this in action:

In addition, to help validate the CLI and to simplify usage of certain APIs, we have started to leverage the CLI to build experimental NodeJS projections for APIs such as LanguageModel. Check out our @microsoft/winapp-windows-ai npm package for using Windows AI APIs directly from NodeJS.

Get started today

The Windows App Development CLI is available now in public preview. Visit our GitHub repository for documentation, guides and to file issues.

We would love to hear your feedback!

To get started:

Install via WinGet (for general use):
winget install microsoft.winappcli

Install via npm (for Electron projects):
npm install --save-dev @microsoft/winappcli

Check out our Electron, .NET,  C++/CMAKE, or Rust guides for getting started quickly.

Happy coding!

联系我们 contact @ memedata.com