0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

WinApp CLIを試す(vscode+WinApp Extension)

0
Last updated at Posted at 2026-05-29

はじめに

Windowsアプリケーション(WinUI3)についても、vscodeで開発できるようになってきたそうな。
やっていきましょう。

事前準備

dotnet new に winui3用のテンプレート を追加する

dotnet new install Microsoft.WindowsAppSDK.WinUI.CSharp.Templates

WinApp CLI を wingetする

winget install Microsoft.winappcli --source winget  

codeの拡張機能をインストール

WinApp — VS Code Extension
microsoft-winappcli.winapp

codeで新規フォルダを開く

場所は任意だけど、Cドライブがいいと思う。

実践

winui3-mvvmプロジェクトを作成する

PS C:\Users\kashin777\source\repos> dotnet new winui3-mvvm  --name WinAppCLIDemo

vscodeで開いて

PS C:\Users\kashin777\source\repos> cd WinAppCLIDemo
PS C:\Users\kashin777\source\repos> code .

vscodeの winapp init コマンド実行

[WinApp: Initialize Project] - [stable]

PS C:\Users\kashin777\source2\repos\WinAppCLIDemo> & "c:\Users\kashin777\.vscode\extensions\microsoft-winappcli.winapp-0.1.0\bin\win-x64\winapp.exe" init --use-defaults --setup-sdks none
 .NET project setup completed successfully (SDK installation skipped)                                                                                                         
   Developer Mode setup skipped                                                                                                                                               
   NuGet packages added to WinAppCLIDemo.csproj                                                                                                                               
   Manifest generation skipped                                                                                                                                                
PS C:\Users\kashin777\source2\repos\WinAppCLIDemo> 

vscodeでビルドタスクを実行

dotnet: build

ビルドに成功しました。
    0 個の警告
    0 エラー

vscodeでデバッグ実行

デバッガーの選択でWinAppを選択すると...

起動しました。
image.png

RelayCommandにブレイクポイント貼ったら、ちゃんと処理が止まった。

【付録】

MSIX作る(オレオレ証明書)

dotnet build -c Release

winapp cert generate

# 管理者権限 (インストールしないなら不要)
# winapp cert install .\devcert.pfx

#
winapp pack bin\Release\net10.0-windows10.0.26100.0\win-x64\publish --cert .\devcert.pfx

実行前はとにかくビルドしたい

実行する前に勝手にビルドされるのかと思ったらそうでもないらしい。
launchTaskにpreLaunchTaskを追加。

.vscode/tasks.json
{
	"version": "2.0.0",
	"tasks": [
		{
		"label": "Build",
		"command": "dotnet",
		"args": ["build"],
		"type": "process"
		}
	]
}
.vscode/launch.json
{
    "version": "0.2.0",
    "configurations": [

        {
            "type": "winapp",
            "request": "launch",
            "name": "WinApp: Launch and Attach",
            "preLaunchTask": "Build"
        }
    ]
}

WinApp向けのAgent Pluginが出たらしい

Introducing WinUI agent plugin for GitHub Copilot and Claude Code
使える人はご利用になればヨロシ。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?