winui-dev-workflow

Fluxo de trabalho de criação e execução para aplicativos WinUI 3 — criação de projeto, script BuildAndRun.ps1, execução winapp, diagnóstico de erros e pré-requisitos. Use ao criar, executar,…

npx skills add https://github.com/microsoft/win-dev-skills --skill winui-dev-workflow

Create or Open a Project

New app — let WinApp CLI install/update the official templates and scaffold:

winapp new --name <AppName> --template winui-mvvm --template-version latest --use-defaults
cd <AppName>

Run winapp new --list to discover the currently installed template short names. Do not install the template pack separately and do not create the output directory first.

Existing app — read the .csproj to understand:

  • <TargetFramework> (e.g., net10.0-windows10.0.26100.0)
  • <PackageReference> versions (WindowsAppSDK, CommunityToolkit)
  • Project structure and established patterns

Install Packages

dotnet add package <Name>

Never specify --version — omitting it gets the latest stable and avoids outdated API mismatches.

Build & Run

WinApp CLI 0.6+ builds a .csproj and launches it directly:

winapp run . --debug-output
winapp run .\MyApp.csproj -c Release --arch arm64

For normal development, prefer the included BuildAndRun.ps1 wrapper. It invokes project-mode winapp run, injects the bundled Microsoft.WindowsAppSDK.Analyzers, and turns on --debug-output by default:

.\BuildAndRun.ps1

Invoke attached runs with mode: "async". The command stays attached while the app is open, so a synchronous call blocks for the app's lifetime. The output contains the running app's PID.

The wrapper only adds repository-specific analyzer and debug defaults. WinApp CLI handles:

  1. Project restore and build
  2. Configuration, architecture, runtime, and framework selection
  3. Packaged versus unpackaged detection
  4. Build-output and executable discovery
  5. Windows App Runtime setup
  6. Package registration and launch

Options and forwarded WinApp arguments:

.\BuildAndRun.ps1                              # one top-level csproj; attached diagnostics
.\BuildAndRun.ps1 .\MyApp.csproj               # explicit project
.\BuildAndRun.ps1 .\MyApp.csproj -c Release    # forwarded to winapp run
.\BuildAndRun.ps1 .\MyApp.csproj --arch arm64  # forwarded to winapp run
.\BuildAndRun.ps1 . --detach --json             # return after launch; emit PID as JSON
.\BuildAndRun.ps1 . --symbols                   # add Symbol Server-backed native symbols
.\BuildAndRun.ps1 --args "--flag value"         # pass application arguments

The wrapper accepts the same .csproj, .sln/.slnx, directory, and --project inputs as winapp run.

If build fails: Read all errors, batch-fix them in one pass, then rerun the same command.

If the app crashes on launch: read_powershell the shell — first-chance exceptions appear in the output. See the crash-diagnosis section below for WinUI stowed-exception triage.

Diagnosing Crashes with winapp run

For WinUI apps, --debug-output (the wrapper default) runs a stowed-exception triage on crash, surfacing the real WinUI/XAML error behind an opaque 0x8000FFFF / E_FAIL. The first crash downloads debugger components and can take a few minutes; point WINAPP_DBGTOOLS_DIR at an existing Debugging Tools for Windows install for offline/locked-down environments. Add --symbols for richer native frames.

Common Errors

ErrorFix
Developer Mode not enabledSettings → System → For developers → On
CS0234/CS0246 missing typeAdd using or dotnet add package
NETSDK1136 platform requiredTarget a Windows TFM (for example net10.0-windows10.0.26100.0); use -f <windows-tfm> when the project already multi-targets
XLS0414 XAML type not foundAdd xmlns declaration
XDG0062 binding path missingCheck x:Bind property exists on ViewModel
Blank window after launchx:Bind defaults to OneTime — add Mode=OneWay
App silently exitsUse winapp run, never run the .exe directly
App crashes with opaque 0x8000FFFF / E_FAILRun under --debug-output (BuildAndRun.ps1 default) — WinUI stowed-exception triage surfaces the real XAML error + symbolicated native stack. --symbols is optional
XAML compiler crashes silentlyRemove any PresentationCore.dll / System.Windows references
MSB3073 / XamlCompiler.exe ... exited with code 1, no .xaml namedOld WindowsAppSDK XAML-compiler bug — update Microsoft.WindowsAppSDK NuGet to latest (≥ 2.1.3, or ≥ 1.8 on the 1.x line)
0x80073CF6 package install failedCheck the manifest publisher and Developer Mode; apps from winapp new need no separate winapp init
0x80073CF9 / "Failed to reach state Staged" on a deeply nested projectFor a packaged app, rerun with --output-appx-directory "$env:LOCALAPPDATA\winapp-layout\<app>-<config>-<arch>", or move the repo closer to the drive root. Keep the directory unique per configuration and architecture — a registered development package holds a live reference to it, so Debug and Release must not share one — and empty it before reuse so payload files dropped since the last build do not linger
0x8007000B bad image formatWrong platform target — use x64 or ARM64, not AnyCPU

Prerequisites

RequirementMinimumRecommended (fresh installs)Install command
Windows 10 v1903+———
Developer ModeenabledenabledSettings → Advanced → Developer Mode → On
.NET SDK8.0.10010.0winget install Microsoft.DotNet.SDK.10
WinApp CLI0.6.0latest/winui-setup

If winapp/dotnet is missing or too old, or Developer Mode is off, do not install it ad hoc or work around it. Ask the user to run /winui-setup, then retry. winapp new manages the WinUI template pack itself.

Critical Rules

  • ❌ NEVER run the packaged .exe directly — always use project-mode winapp run or BuildAndRun.ps1
  • ❌ NEVER add <WindowsPackageType>None to work around launch issues
  • ❌ NEVER delete Package.appxmanifest
  • ❌ NEVER use AnyCPU — always x64 or ARM64

References

  • BuildAndRun.ps1 — included with this skill; adds the bundled analyzer and diagnostic defaults to winapp run

Mais skills de microsoft

oss-growth
microsoft
Persona de growth hacker OSS
agent-framework-azure-ai-py
microsoft
Crie agentes do Azure AI Foundry usando o SDK Python do Microsoft Agent Framework (agent-framework-azure-ai). Use ao criar agentes persistentes com AzureAIAgentsProvider, usando ferramentas hospedadas (interpretador de código, pesquisa de arquivos, pesquisa na web), integrando servidores MCP, gerenciando threads de conversa ou implementando respostas em streaming. Abrange ferramentas de função, saídas estruturadas e agentes com múltiplas ferramentas.
development
airunway-aks-setup
microsoft
Configure o AI Runway no AKS — do cluster vazio ao modelo em execução. Abrange verificação do cluster, instalação do controlador, avaliação de GPU, configuração do provedor e primeira implantação. QUANDO: "configurar AI Runway", "integrar cluster AKS", "instalar AI Runway", "configuração do airunway", "implantar modelo no AKS", "inferência GPU no AKS", "configuração KAITO no AKS", "executar LLM no AKS", "vLLM no AKS", "configurar serviço de modelo no AKS", "controlador AI Runway".
devops
appinsights-instrumentation
microsoft
Orientação para instrumentar aplicações web com Azure Application Insights. Fornece padrões de telemetria, configuração de SDK e referências de configuração. QUANDO: como instrumentar o app, SDK do App Insights, padrões de telemetria, o que é App Insights, orientação sobre Application Insights, exemplos de instrumentação, melhores práticas de APM.
devops
applicationinsights-web-ts
microsoft
Instrumente aplicativos de navegador/web com o SDK JavaScript do Application Insights (@microsoft/applicationinsights-web). Use para Real User Monitoring (RUM) — visualizações de página, cliques, dependências AJAX/fetch, exceções, eventos personalizados e rastreamentos de agentes GenAI no lado do navegador correlacionados a rastreamentos OpenTelemetry no backend. Abrange o Script de Carregamento do SDK e a configuração via npm, extensões de frameworks (React, React Native, Angular), Click Analytics, inicializadores de telemetria e convenções semânticas GenAI do OTel para spans de agente/ferramenta/modelo emitidos pelo navegador.
devops
azure-ai-anomalydetector-java
microsoft
Crie aplicativos de detecção de anomalias com o SDK do Azure AI Anomaly Detector para Java. Use ao implementar detecção de anomalias univariada/multivariada, análise de séries temporais ou monitoramento com IA.
development
azure-ai-language-conversations-py
microsoft
Implemente o reconhecimento de linguagem conversacional (CLU) usando o SDK Python azure-ai-language-conversations. Use ao trabalhar com ConversationAnalysisClient para analisar intenção e entidades de conversas, criar recursos de NLP ou integrar o reconhecimento de linguagem em aplicativos.
development
azure-ai-ml-py
microsoft
SDK v2 do Azure Machine Learning para Python. Use para workspaces de ML, jobs, modelos, conjuntos de dados, computação e pipelines. Gatilhos: "azure-ai-ml", "MLClient", "workspace", "registro de modelos", "jobs de treinamento", "conjuntos de dados".
development