Muistiinpano
Tämän sivun käyttö edellyttää valtuutusta. Voit yrittää kirjautua sisään tai vaihtaa hakemistoa.
Tämän sivun käyttö edellyttää valtuutusta. Voit yrittää vaihtaa hakemistoa.
This guide walks you through adding Windows-native capabilities to an Electron application using the Windows App Development CLI. You'll learn how to call modern Windows APIs from your Electron app, test with app identity, and package for distribution.
What You'll Build
By the end of this guide, you'll have an Electron app that:
- ✅ Calls modern Windows APIs (Windows SDK and Windows App SDK)
- ✅ Uses a native addon with AI capabilities (Phi Silica or WinML)
- ✅ Runs with app identity for testing protected APIs
- ✅ Packages as a signed MSIX for distribution
Prerequisites
Before starting, ensure you have:
- Windows 11 (Copilot+ PC if using Phi Silica)
- Node.js -
winget install OpenJS.NodeJS --source winget - .NET SDK v10 -
winget install Microsoft.DotNet.SDK.10 --source winget - Visual Studio with the Native Desktop Workload -
winget install --id Microsoft.VisualStudio.Community --source winget --override "--add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --passive --wait"
The Process
Building a Windows-enabled Electron app involves three main phases:
1. Setting Up the Development Environment
First, you'll set up your development environment with the necessary tools and SDKs. This includes:
- Creating or configuring an Electron app
- Installing winapp CLI
- Initializing Windows SDKs and required assets
- Setting up your build pipeline
2. Creating a Native Addon
Next, you'll create a native addon that calls Windows APIs. Choose one of the following guides:
Option A: Creating a C++ Notification Addon
Learn how to create a C++ addon that calls the Windows App SDK notification APIs. This is a great starting point for understanding native addons before diving into more complex scenarios.
Create a C++ Notification Addon →
Option B: Creating a Phi Silica Addon
Learn how to create a C# addon that uses the Phi Silica AI model to summarize text on-device. Phi Silica is a small language model that runs locally on Windows 11 devices with NPUs.
Option C: Creating a WinML Addon
Learn how to create a C# addon that uses Windows Machine Learning (WinML) to run custom ONNX models for image classification, object detection, and more.
3. Packaging for Distribution
Finally, you'll package your app as an MSIX for distribution. This includes:
- Building your app for production
- Creating and signing an MSIX package
- Testing the installed package
- Understanding distribution options
Quick Navigation
| Phase | Guide | What You'll Learn |
|---|---|---|
| 1️⃣ | Setup | Install tools, initialize SDKs, configure build pipeline |
| 2️⃣ | C++ Notification Addon | Create C++ addon, call notification APIs, test with debug identity |
| 2️⃣ | Phi Silica Addon | Create C# addon, call AI APIs, test with debug identity |
| 2️⃣ | WinML Addon | Create C# addon, call WinML APIs, run ONNX models, integrate ML |
| 3️⃣ | Packaging | Build production app, create MSIX, distribute |
Additional Resources
- winapp CLI Documentation - Full CLI reference
- Sample Electron App - Complete working example
- AI Dev Gallery - Sample gallery of all AI APIs
- Windows App SDK Samples - Collection of Windows App SDK samples
- node-api-dotnet - C# ↔ JavaScript interop library
Get Help
- Found a bug? File an issue
Windows developer