From 616524fb4dd3062945ed89711110e88269beb2b9 Mon Sep 17 00:00:00 2001
From: Nikola Metulev <711864+nmetulev@users.noreply.github.com>
Date: Sat, 28 Mar 2026 21:46:34 -0700
Subject: [PATCH 1/3] added frame and mainpage to main window
---
.../SingleProjectPackagedApp/MainPage.xaml | 18 ++++++++++++++++
.../SingleProjectPackagedApp/MainPage.xaml.cs | 20 ++++++++++++++++++
.../SingleProjectPackagedApp/MainWindow.xaml | 7 ++++++-
.../MainWindow.xaml.cs | 21 +++++++------------
...top.Cs.SingleProjectPackagedApp.vstemplate | 2 ++
5 files changed, 54 insertions(+), 14 deletions(-)
create mode 100644 dev/VSIX/ProjectTemplates/Desktop/CSharp/SingleProjectPackagedApp/MainPage.xaml
create mode 100644 dev/VSIX/ProjectTemplates/Desktop/CSharp/SingleProjectPackagedApp/MainPage.xaml.cs
diff --git a/dev/VSIX/ProjectTemplates/Desktop/CSharp/SingleProjectPackagedApp/MainPage.xaml b/dev/VSIX/ProjectTemplates/Desktop/CSharp/SingleProjectPackagedApp/MainPage.xaml
new file mode 100644
index 0000000000..c7c89c7238
--- /dev/null
+++ b/dev/VSIX/ProjectTemplates/Desktop/CSharp/SingleProjectPackagedApp/MainPage.xaml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
diff --git a/dev/VSIX/ProjectTemplates/Desktop/CSharp/SingleProjectPackagedApp/MainPage.xaml.cs b/dev/VSIX/ProjectTemplates/Desktop/CSharp/SingleProjectPackagedApp/MainPage.xaml.cs
new file mode 100644
index 0000000000..6fc70d7281
--- /dev/null
+++ b/dev/VSIX/ProjectTemplates/Desktop/CSharp/SingleProjectPackagedApp/MainPage.xaml.cs
@@ -0,0 +1,20 @@
+using Microsoft.UI.Xaml.Controls;
+
+// To learn more about WinUI, the WinUI project structure,
+// and more about our project templates, see: http://aka.ms/winui-project-info.
+
+namespace $safeprojectname$;
+
+///
+/// The main content page displayed inside the application window.
+/// Add your UI logic, event handlers, and data binding here.
+///
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ InitializeComponent();
+
+ // TODO: Add your initialization logic here.
+ }
+}
diff --git a/dev/VSIX/ProjectTemplates/Desktop/CSharp/SingleProjectPackagedApp/MainWindow.xaml b/dev/VSIX/ProjectTemplates/Desktop/CSharp/SingleProjectPackagedApp/MainWindow.xaml
index 5fea18ee61..29974c45fd 100644
--- a/dev/VSIX/ProjectTemplates/Desktop/CSharp/SingleProjectPackagedApp/MainWindow.xaml
+++ b/dev/VSIX/ProjectTemplates/Desktop/CSharp/SingleProjectPackagedApp/MainWindow.xaml
@@ -24,6 +24,11 @@
-
+
+
diff --git a/dev/VSIX/ProjectTemplates/Desktop/CSharp/SingleProjectPackagedApp/MainWindow.xaml.cs b/dev/VSIX/ProjectTemplates/Desktop/CSharp/SingleProjectPackagedApp/MainWindow.xaml.cs
index 0afda3840e..fc24f9ed43 100644
--- a/dev/VSIX/ProjectTemplates/Desktop/CSharp/SingleProjectPackagedApp/MainWindow.xaml.cs
+++ b/dev/VSIX/ProjectTemplates/Desktop/CSharp/SingleProjectPackagedApp/MainWindow.xaml.cs
@@ -1,23 +1,15 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Runtime.InteropServices.WindowsRuntime;
-using Windows.Foundation;
-using Windows.Foundation.Collections;
using Microsoft.UI.Xaml;
-using Microsoft.UI.Xaml.Controls;
-using Microsoft.UI.Xaml.Controls.Primitives;
-using Microsoft.UI.Xaml.Data;
-using Microsoft.UI.Xaml.Input;
-using Microsoft.UI.Xaml.Media;
-using Microsoft.UI.Xaml.Navigation;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
namespace $safeprojectname$;
+///
+/// The application window. This hosts a Frame that displays pages. Add your
+/// UI and logic to MainPage.xaml / MainPage.xaml.cs instead of here so you
+/// can use Page features such as navigation events and the Loaded lifecycle.
+///
public sealed partial class MainWindow : Window
{
public MainWindow()
@@ -28,5 +20,8 @@ public MainWindow()
SetTitleBar(AppTitleBar);
AppWindow.SetIcon("Assets/AppIcon.ico");
+
+ // Navigate the root frame to the main page on startup.
+ RootFrame.Navigate(typeof(MainPage));
}
}
diff --git a/dev/VSIX/ProjectTemplates/Desktop/CSharp/SingleProjectPackagedApp/WinUI.Desktop.Cs.SingleProjectPackagedApp.vstemplate b/dev/VSIX/ProjectTemplates/Desktop/CSharp/SingleProjectPackagedApp/WinUI.Desktop.Cs.SingleProjectPackagedApp.vstemplate
index 2a1fb70704..c6ae8a402c 100644
--- a/dev/VSIX/ProjectTemplates/Desktop/CSharp/SingleProjectPackagedApp/WinUI.Desktop.Cs.SingleProjectPackagedApp.vstemplate
+++ b/dev/VSIX/ProjectTemplates/Desktop/CSharp/SingleProjectPackagedApp/WinUI.Desktop.Cs.SingleProjectPackagedApp.vstemplate
@@ -39,6 +39,8 @@
App.xaml.cs
MainWindow.xaml
MainWindow.xaml.cs
+ MainPage.xaml
+ MainPage.xaml.cs
Package-managed.appxmanifest
SplashScreen.scale-200.png
From 1746e7025927f3d1da8240271493fa63016baffc Mon Sep 17 00:00:00 2001
From: Nikola Metulev <711864+nmetulev@users.noreply.github.com>
Date: Sat, 28 Mar 2026 22:43:15 -0700
Subject: [PATCH 2/3] winui template updates
---
...WinAppSdk.CSharp.DotnetNewTemplates.csproj | 17 ++++++
.../.template.config/template.json | 10 +++-
.../templates/gitignore.txt | 54 +++++++++++++++++++
.../.template.config/template.json | 2 +-
.../.template.config/template.json | 3 +-
.../.template.config/template.json | 2 +-
.../.template.config/template.json | 2 +-
.../item-resw/.template.config/template.json | 2 +-
.../.template.config/template.json | 2 +-
.../.template.config/template.json | 2 +-
.../.template.config/template.json | 51 ++++++++++++++++--
.../.template.config/template.json | 42 +++++++++++++--
.../unit-test/.template.config/template.json | 8 +--
.../Desktop/CSharp/ClassLibrary/Class1.cs | 6 ---
.../ClassLibrary/ProjectTemplate.csproj | 1 +
.../Desktop/CSharp/NavigationApp/App.xaml.cs | 8 ++-
.../CSharp/NavigationApp/MainWindow.xaml.cs | 1 -
.../NavigationApp/Pages/AboutPage.xaml.cs | 1 -
.../NavigationApp/Pages/HomePage.xaml.cs | 1 -
.../NavigationApp/Pages/SettingsPage.xaml.cs | 1 -
.../NavigationApp/ProjectTemplate.csproj | 8 +--
.../SingleProjectPackagedApp/App.xaml.cs | 7 +--
.../ProjectTemplate.csproj | 5 +-
.../CSharp/UnitTestApp/ProjectTemplate.csproj | 1 +
.../CSharp/UnitTestApp/UnitTestApp.xaml.cs | 7 +--
.../UnitTestApp/UnitTestAppWindow.xaml.cs | 5 --
.../Desktop/CSharp/UnitTestApp/UnitTests.cs | 3 --
27 files changed, 196 insertions(+), 56 deletions(-)
create mode 100644 dev/VSIX/DotnetNewTemplates/templates/gitignore.txt
diff --git a/dev/VSIX/DotnetNewTemplates/WinAppSdk.CSharp.DotnetNewTemplates.csproj b/dev/VSIX/DotnetNewTemplates/WinAppSdk.CSharp.DotnetNewTemplates.csproj
index 58f2607305..a92e99cf78 100644
--- a/dev/VSIX/DotnetNewTemplates/WinAppSdk.CSharp.DotnetNewTemplates.csproj
+++ b/dev/VSIX/DotnetNewTemplates/WinAppSdk.CSharp.DotnetNewTemplates.csproj
@@ -31,6 +31,11 @@
+
+
+ <_GitignoreSource>templates\gitignore.txt
+
+
+
@@ -63,6 +71,9 @@
+
@@ -74,6 +85,9 @@
Exclude="..\ProjectTemplates\Desktop\CSharp\ClassLibrary\bin\**;..\ProjectTemplates\Desktop\CSharp\ClassLibrary\obj\**;..\ProjectTemplates\Desktop\CSharp\ClassLibrary\WinUI.Desktop.Cs.ClassLibrary.csproj;..\ProjectTemplates\Desktop\CSharp\ClassLibrary\WinUI.Desktop.Cs.ClassLibrary.ico;..\ProjectTemplates\Desktop\CSharp\ClassLibrary\WinUI.Desktop.Cs.ClassLibrary.png;..\ProjectTemplates\Desktop\CSharp\ClassLibrary\WinUI.Desktop.Cs.ClassLibrary.vstemplate"
Pack="true"
PackagePath="content/winui.classlib/%(RecursiveDir)%(Filename)%(Extension)" />
+
@@ -88,6 +102,9 @@
+
diff --git a/dev/VSIX/DotnetNewTemplates/templates/class-library/.template.config/template.json b/dev/VSIX/DotnetNewTemplates/templates/class-library/.template.config/template.json
index 637221e32a..c8b7ccb38e 100644
--- a/dev/VSIX/DotnetNewTemplates/templates/class-library/.template.config/template.json
+++ b/dev/VSIX/DotnetNewTemplates/templates/class-library/.template.config/template.json
@@ -9,8 +9,7 @@
"identity": "Microsoft.WindowsAppSDK.WinUI.CSharp.ClassLibrary",
"groupIdentity": "Microsoft.WindowsAppSDK.WinUI.CSharp.ClassLibrary",
"name": "WinUI Class Library",
- "shortName": "winui-lib",
- "shortNameList": ["wasdk-classlib"],
+ "shortName": ["winui-lib", "winui3-lib", "wasdk-classlib"],
"sourceName": "ProjectTemplate",
"defaultName": "WinUILibrary",
"description": "Creates a WinUI 3 class library for sharing UI components.",
@@ -77,6 +76,13 @@
"replaces": "$DotNetVersion$"
}
},
+ "sources": [
+ {
+ "rename": {
+ "gitignore.txt": ".gitignore"
+ }
+ }
+ ],
"primaryOutputs": [
{ "path": "ProjectTemplate.csproj" }
],
diff --git a/dev/VSIX/DotnetNewTemplates/templates/gitignore.txt b/dev/VSIX/DotnetNewTemplates/templates/gitignore.txt
new file mode 100644
index 0000000000..dd393563d9
--- /dev/null
+++ b/dev/VSIX/DotnetNewTemplates/templates/gitignore.txt
@@ -0,0 +1,54 @@
+## .NET / Visual Studio
+[Bb]in/
+[Oo]bj/
+[Dd]ebug/
+[Rr]elease/
+.vs/
+*.user
+*.suo
+*.userosscache
+*.sln.docstates
+artifacts/
+
+# Build logs
+[Ll]og/
+[Ll]ogs/
+*.log
+*.binlog
+
+# Test results
+[Tt]est[Rr]esult*/
+*.trx
+*.coverage
+*.coveragexml
+
+# NuGet
+*.nupkg
+*.snupkg
+*.nuget.props
+*.nuget.targets
+project.lock.json
+
+# MSIX packaging output
+AppPackages/
+BundleArtifacts/
+*.msix
+*.msixupload
+*.appx
+*.appxbundle
+*.appxupload
+
+# Publish output
+publish/
+*.pubxml
+PublishScripts/
+
+# Code analysis and tooling
+_ReSharper*/
+*.DotSettings.user
+*.dotCover
+.idea/
+
+# Generated files
+Generated\ Files/
+*_wpftmp.csproj
diff --git a/dev/VSIX/DotnetNewTemplates/templates/item-blank-page/.template.config/template.json b/dev/VSIX/DotnetNewTemplates/templates/item-blank-page/.template.config/template.json
index 8173042d89..80af991e23 100644
--- a/dev/VSIX/DotnetNewTemplates/templates/item-blank-page/.template.config/template.json
+++ b/dev/VSIX/DotnetNewTemplates/templates/item-blank-page/.template.config/template.json
@@ -9,7 +9,7 @@
"identity": "Microsoft.WindowsAppSDK.WinUI.CSharp.Item.Page",
"groupIdentity": "Microsoft.WindowsAppSDK.WinUI.CSharp.Item.Page",
"name": "WinUI Blank Page (Item)",
- "shortName": "winui-page",
+ "shortName": ["winui-page", "winui3-page"],
"sourceName": "BlankPage",
"defaultName": "BlankPage",
"description": "Adds a WinUI 3 Page with XAML markup and code-behind.",
diff --git a/dev/VSIX/DotnetNewTemplates/templates/item-blank-window/.template.config/template.json b/dev/VSIX/DotnetNewTemplates/templates/item-blank-window/.template.config/template.json
index 18a9cdf496..5845179f18 100644
--- a/dev/VSIX/DotnetNewTemplates/templates/item-blank-window/.template.config/template.json
+++ b/dev/VSIX/DotnetNewTemplates/templates/item-blank-window/.template.config/template.json
@@ -9,8 +9,7 @@
"identity": "Microsoft.WindowsAppSDK.WinUI.CSharp.Item.Window",
"groupIdentity": "Microsoft.WindowsAppSDK.WinUI.CSharp.Item.Window",
"name": "WinUI Blank Window (Item)",
- "shortName": "winui-window",
- "shortNameList": ["wasdk-item-blankwin"],
+ "shortName": ["winui-window", "winui3-window", "wasdk-item-blankwin"],
"sourceName": "BlankWindow",
"defaultName": "BlankWindow",
"description": "Adds a WinUI 3 Window with XAML markup and code-behind.",
diff --git a/dev/VSIX/DotnetNewTemplates/templates/item-content-dialog/.template.config/template.json b/dev/VSIX/DotnetNewTemplates/templates/item-content-dialog/.template.config/template.json
index e5878e6ade..d713e6e836 100644
--- a/dev/VSIX/DotnetNewTemplates/templates/item-content-dialog/.template.config/template.json
+++ b/dev/VSIX/DotnetNewTemplates/templates/item-content-dialog/.template.config/template.json
@@ -9,7 +9,7 @@
"identity": "Microsoft.WindowsAppSDK.WinUI.CSharp.Item.ContentDialog",
"groupIdentity": "Microsoft.WindowsAppSDK.WinUI.CSharp.Item.ContentDialog",
"name": "WinUI Content Dialog (Item)",
- "shortName": "winui-dialog",
+ "shortName": ["winui-dialog", "winui3-dialog"],
"sourceName": "ContentDialog",
"defaultName": "ContentDialog",
"description": "Adds a WinUI 3 ContentDialog with markup and code-behind.",
diff --git a/dev/VSIX/DotnetNewTemplates/templates/item-resource-dictionary/.template.config/template.json b/dev/VSIX/DotnetNewTemplates/templates/item-resource-dictionary/.template.config/template.json
index 21c2ba7db0..85a6963a3e 100644
--- a/dev/VSIX/DotnetNewTemplates/templates/item-resource-dictionary/.template.config/template.json
+++ b/dev/VSIX/DotnetNewTemplates/templates/item-resource-dictionary/.template.config/template.json
@@ -9,7 +9,7 @@
"identity": "Microsoft.WindowsAppSDK.WinUI.CSharp.Item.ResourceDictionary",
"groupIdentity": "Microsoft.WindowsAppSDK.WinUI.CSharp.Item.ResourceDictionary",
"name": "WinUI Resource Dictionary (Item)",
- "shortName": "winui-resourcedictionary",
+ "shortName": ["winui-resourcedictionary", "winui3-resourcedictionary"],
"sourceName": "ResourceDictionary",
"defaultName": "ResourceDictionary",
"description": "Adds a WinUI 3 ResourceDictionary for sharing styles and resources.",
diff --git a/dev/VSIX/DotnetNewTemplates/templates/item-resw/.template.config/template.json b/dev/VSIX/DotnetNewTemplates/templates/item-resw/.template.config/template.json
index ce91f47bc5..8ee40d3b4a 100644
--- a/dev/VSIX/DotnetNewTemplates/templates/item-resw/.template.config/template.json
+++ b/dev/VSIX/DotnetNewTemplates/templates/item-resw/.template.config/template.json
@@ -9,7 +9,7 @@
"identity": "Microsoft.WindowsAppSDK.WinUI.CSharp.Item.Resw",
"groupIdentity": "Microsoft.WindowsAppSDK.WinUI.CSharp.Item.Resw",
"name": "WinUI Resources File (Item)",
- "shortName": "winui-resw",
+ "shortName": ["winui-resw", "winui3-resw"],
"sourceName": "Resources",
"defaultName": "Resources",
"description": "Adds a RESW resources file for localized strings.",
diff --git a/dev/VSIX/DotnetNewTemplates/templates/item-templated-control/.template.config/template.json b/dev/VSIX/DotnetNewTemplates/templates/item-templated-control/.template.config/template.json
index 2e09c809ea..4e3b4d01df 100644
--- a/dev/VSIX/DotnetNewTemplates/templates/item-templated-control/.template.config/template.json
+++ b/dev/VSIX/DotnetNewTemplates/templates/item-templated-control/.template.config/template.json
@@ -9,7 +9,7 @@
"identity": "Microsoft.WindowsAppSDK.WinUI.CSharp.Item.TemplatedControl",
"groupIdentity": "Microsoft.WindowsAppSDK.WinUI.CSharp.Item.TemplatedControl",
"name": "WinUI Templated Control (Item)",
- "shortName": "winui-templatedcontrol",
+ "shortName": ["winui-templatedcontrol", "winui3-templatedcontrol"],
"sourceName": "CustomControl",
"defaultName": "CustomControl",
"description": "Adds a WinUI 3 templated control with a code-behind skeleton.",
diff --git a/dev/VSIX/DotnetNewTemplates/templates/item-user-control/.template.config/template.json b/dev/VSIX/DotnetNewTemplates/templates/item-user-control/.template.config/template.json
index 355229b808..6669fe6841 100644
--- a/dev/VSIX/DotnetNewTemplates/templates/item-user-control/.template.config/template.json
+++ b/dev/VSIX/DotnetNewTemplates/templates/item-user-control/.template.config/template.json
@@ -9,7 +9,7 @@
"identity": "Microsoft.WindowsAppSDK.WinUI.CSharp.Item.UserControl.Legacy",
"groupIdentity": "Microsoft.WindowsAppSDK.WinUI.CSharp.Item.UserControl.Legacy",
"name": "WinUI User Control (Item)",
- "shortName": "winui-usercontrol",
+ "shortName": ["winui-usercontrol", "winui3-usercontrol"],
"sourceName": "UserControl",
"defaultName": "UserControl",
"description": "Adds a WinUI 3 UserControl with markup and code-behind.",
diff --git a/dev/VSIX/DotnetNewTemplates/templates/navigation-app/.template.config/template.json b/dev/VSIX/DotnetNewTemplates/templates/navigation-app/.template.config/template.json
index 53f9053817..e5bc8f4ddd 100644
--- a/dev/VSIX/DotnetNewTemplates/templates/navigation-app/.template.config/template.json
+++ b/dev/VSIX/DotnetNewTemplates/templates/navigation-app/.template.config/template.json
@@ -9,7 +9,7 @@
"identity": "Microsoft.WindowsAppSDK.WinUI.CSharp.NavigationApp",
"groupIdentity": "Microsoft.WindowsAppSDK.WinUI.CSharp.NavigationApp",
"name": "WinUI NavigationView App",
- "shortName": "winui-navview",
+ "shortName": ["winui-navview", "winui3-navview"],
"sourceName": "ProjectTemplate",
"defaultName": "WinUINavApp",
"description": "Creates a WinUI 3 NavigationView starter app with single-project MSIX packaging.",
@@ -95,6 +95,20 @@
"type": "parameter",
"datatype": "bool",
"defaultValue": "true"
+ },
+ "windowsAppSdkVersion": {
+ "type": "parameter",
+ "datatype": "text",
+ "replaces": "$WindowsAppSdkVersion$",
+ "defaultValue": "1.8.260317003",
+ "description": "Version of the Microsoft.WindowsAppSDK NuGet package."
+ },
+ "windowsSdkBuildToolsVersion": {
+ "type": "parameter",
+ "datatype": "text",
+ "replaces": "$WindowsSdkBuildToolsVersion$",
+ "defaultValue": "10.0.26100.7705",
+ "description": "Version of the Microsoft.Windows.SDK.BuildTools NuGet package."
}
},
"sources": [
@@ -112,7 +126,10 @@
}
]
}
- ]
+ ],
+ "rename": {
+ "gitignore.txt": ".gitignore"
+ }
}
],
"primaryOutputs": [
@@ -125,5 +142,33 @@
"identity": {
"identifier": "identity"
}
- }
+ },
+ "postActions": [
+ {
+ "actionId": "B17581D1-C5C9-4489-8F0A-004BE667B814",
+ "continueOnError": true,
+ "description": "Update Microsoft.WindowsAppSDK to the latest stable version.",
+ "args": {
+ "referenceType": "package",
+ "reference": "Microsoft.WindowsAppSDK"
+ },
+ "manualInstructions": [{ "text": "Run 'dotnet add package Microsoft.WindowsAppSDK'" }]
+ },
+ {
+ "actionId": "B17581D1-C5C9-4489-8F0A-004BE667B814",
+ "continueOnError": true,
+ "description": "Update Microsoft.Windows.SDK.BuildTools to the latest stable version.",
+ "args": {
+ "referenceType": "package",
+ "reference": "Microsoft.Windows.SDK.BuildTools"
+ },
+ "manualInstructions": [{ "text": "Run 'dotnet add package Microsoft.Windows.SDK.BuildTools'" }]
+ },
+ {
+ "actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
+ "continueOnError": true,
+ "description": "Restore NuGet packages required by this project.",
+ "manualInstructions": [{ "text": "Run 'dotnet restore'" }]
+ }
+ ]
}
diff --git a/dev/VSIX/DotnetNewTemplates/templates/single-project/.template.config/template.json b/dev/VSIX/DotnetNewTemplates/templates/single-project/.template.config/template.json
index 1e9e33bcce..7db5ef1944 100644
--- a/dev/VSIX/DotnetNewTemplates/templates/single-project/.template.config/template.json
+++ b/dev/VSIX/DotnetNewTemplates/templates/single-project/.template.config/template.json
@@ -9,8 +9,7 @@
"identity": "Microsoft.WindowsAppSDK.WinUI.CSharp.BlankApp",
"groupIdentity": "Microsoft.WindowsAppSDK.WinUI.CSharp.BlankApp",
"name": "WinUI Blank App",
- "shortName": "winui",
- "shortNameList": ["wasdk-single"],
+ "shortName": ["winui", "winui3", "wasdk-single"],
"sourceName": "ProjectTemplate",
"defaultName": "WinUIApp",
"description": "Creates a WinUI 3 desktop app with single-project MSIX packaging.",
@@ -109,6 +108,20 @@
"type": "parameter",
"datatype": "bool",
"defaultValue": "true"
+ },
+ "windowsAppSdkVersion": {
+ "type": "parameter",
+ "datatype": "text",
+ "replaces": "$WindowsAppSdkVersion$",
+ "defaultValue": "1.8.260317003",
+ "description": "Version of the Microsoft.WindowsAppSDK NuGet package."
+ },
+ "windowsSdkBuildToolsVersion": {
+ "type": "parameter",
+ "datatype": "text",
+ "replaces": "$WindowsSdkBuildToolsVersion$",
+ "defaultValue": "10.0.26100.7705",
+ "description": "Version of the Microsoft.Windows.SDK.BuildTools NuGet package."
}
},
"sources": [
@@ -126,7 +139,10 @@
}
]
}
- ]
+ ],
+ "rename": {
+ "gitignore.txt": ".gitignore"
+ }
}
],
"primaryOutputs": [
@@ -141,6 +157,26 @@
}
},
"postActions": [
+ {
+ "actionId": "B17581D1-C5C9-4489-8F0A-004BE667B814",
+ "continueOnError": true,
+ "description": "Update Microsoft.WindowsAppSDK to the latest stable version.",
+ "args": {
+ "referenceType": "package",
+ "reference": "Microsoft.WindowsAppSDK"
+ },
+ "manualInstructions": [{ "text": "Run 'dotnet add package Microsoft.WindowsAppSDK'" }]
+ },
+ {
+ "actionId": "B17581D1-C5C9-4489-8F0A-004BE667B814",
+ "continueOnError": true,
+ "description": "Update Microsoft.Windows.SDK.BuildTools to the latest stable version.",
+ "args": {
+ "referenceType": "package",
+ "reference": "Microsoft.Windows.SDK.BuildTools"
+ },
+ "manualInstructions": [{ "text": "Run 'dotnet add package Microsoft.Windows.SDK.BuildTools'" }]
+ },
{
"actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
"continueOnError": true,
diff --git a/dev/VSIX/DotnetNewTemplates/templates/unit-test/.template.config/template.json b/dev/VSIX/DotnetNewTemplates/templates/unit-test/.template.config/template.json
index 1a4b16a8bb..878a6fa27c 100644
--- a/dev/VSIX/DotnetNewTemplates/templates/unit-test/.template.config/template.json
+++ b/dev/VSIX/DotnetNewTemplates/templates/unit-test/.template.config/template.json
@@ -9,8 +9,7 @@
"identity": "Microsoft.WindowsAppSDK.WinUI.CSharp.UnitTest",
"groupIdentity": "Microsoft.WindowsAppSDK.WinUI.CSharp.UnitTest",
"name": "WinUI Unit Test App",
- "shortName": "winui-unittest",
- "shortNameList": ["wasdk-unittest"],
+ "shortName": ["winui-unittest", "winui3-unittest", "wasdk-unittest"],
"sourceName": "ProjectTemplate",
"defaultName": "WinUITests",
"description": "Creates a WinUI 3 packaged test app that is pre-wired for MSTest.",
@@ -121,7 +120,10 @@
}
]
}
- ]
+ ],
+ "rename": {
+ "gitignore.txt": ".gitignore"
+ }
}
],
"primaryOutputs": [
diff --git a/dev/VSIX/ProjectTemplates/Desktop/CSharp/ClassLibrary/Class1.cs b/dev/VSIX/ProjectTemplates/Desktop/CSharp/ClassLibrary/Class1.cs
index 805fc0ab24..26970a3c16 100644
--- a/dev/VSIX/ProjectTemplates/Desktop/CSharp/ClassLibrary/Class1.cs
+++ b/dev/VSIX/ProjectTemplates/Desktop/CSharp/ClassLibrary/Class1.cs
@@ -1,9 +1,3 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
diff --git a/dev/VSIX/ProjectTemplates/Desktop/CSharp/ClassLibrary/ProjectTemplate.csproj b/dev/VSIX/ProjectTemplates/Desktop/CSharp/ClassLibrary/ProjectTemplate.csproj
index 1a5f771b07..15d7a5bc50 100644
--- a/dev/VSIX/ProjectTemplates/Desktop/CSharp/ClassLibrary/ProjectTemplate.csproj
+++ b/dev/VSIX/ProjectTemplates/Desktop/CSharp/ClassLibrary/ProjectTemplate.csproj
@@ -5,6 +5,7 @@
$safeprojectname$
true
false
+ enable
false
\ No newline at end of file
diff --git a/dev/VSIX/ProjectTemplates/Desktop/CSharp/NavigationApp/App.xaml.cs b/dev/VSIX/ProjectTemplates/Desktop/CSharp/NavigationApp/App.xaml.cs
index 16ecd17bcf..9b38e0006b 100644
--- a/dev/VSIX/ProjectTemplates/Desktop/CSharp/NavigationApp/App.xaml.cs
+++ b/dev/VSIX/ProjectTemplates/Desktop/CSharp/NavigationApp/App.xaml.cs
@@ -1,5 +1,9 @@
-using System;
-using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
diff --git a/dev/VSIX/ProjectTemplates/Desktop/CSharp/NavigationApp/MainWindow.xaml.cs b/dev/VSIX/ProjectTemplates/Desktop/CSharp/NavigationApp/MainWindow.xaml.cs
index 06559e4af3..7fa6bb2664 100644
--- a/dev/VSIX/ProjectTemplates/Desktop/CSharp/NavigationApp/MainWindow.xaml.cs
+++ b/dev/VSIX/ProjectTemplates/Desktop/CSharp/NavigationApp/MainWindow.xaml.cs
@@ -1,4 +1,3 @@
-using System;
using Microsoft.UI.Windowing;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
diff --git a/dev/VSIX/ProjectTemplates/Desktop/CSharp/NavigationApp/Pages/AboutPage.xaml.cs b/dev/VSIX/ProjectTemplates/Desktop/CSharp/NavigationApp/Pages/AboutPage.xaml.cs
index d9d8008512..895e6396bf 100644
--- a/dev/VSIX/ProjectTemplates/Desktop/CSharp/NavigationApp/Pages/AboutPage.xaml.cs
+++ b/dev/VSIX/ProjectTemplates/Desktop/CSharp/NavigationApp/Pages/AboutPage.xaml.cs
@@ -1,4 +1,3 @@
-using System;
using Microsoft.UI.Xaml.Controls;
// To learn more about WinUI, the WinUI project structure,
diff --git a/dev/VSIX/ProjectTemplates/Desktop/CSharp/NavigationApp/Pages/HomePage.xaml.cs b/dev/VSIX/ProjectTemplates/Desktop/CSharp/NavigationApp/Pages/HomePage.xaml.cs
index 0e4f0957bf..3c546496b8 100644
--- a/dev/VSIX/ProjectTemplates/Desktop/CSharp/NavigationApp/Pages/HomePage.xaml.cs
+++ b/dev/VSIX/ProjectTemplates/Desktop/CSharp/NavigationApp/Pages/HomePage.xaml.cs
@@ -1,4 +1,3 @@
-using System;
using Microsoft.UI.Xaml.Controls;
// To learn more about WinUI, the WinUI project structure,
diff --git a/dev/VSIX/ProjectTemplates/Desktop/CSharp/NavigationApp/Pages/SettingsPage.xaml.cs b/dev/VSIX/ProjectTemplates/Desktop/CSharp/NavigationApp/Pages/SettingsPage.xaml.cs
index 1039b8db78..e2b1112ba2 100644
--- a/dev/VSIX/ProjectTemplates/Desktop/CSharp/NavigationApp/Pages/SettingsPage.xaml.cs
+++ b/dev/VSIX/ProjectTemplates/Desktop/CSharp/NavigationApp/Pages/SettingsPage.xaml.cs
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
-using System;
using Microsoft.UI.Xaml.Controls;
// To learn more about WinUI, the WinUI project structure,
diff --git a/dev/VSIX/ProjectTemplates/Desktop/CSharp/NavigationApp/ProjectTemplate.csproj b/dev/VSIX/ProjectTemplates/Desktop/CSharp/NavigationApp/ProjectTemplate.csproj
index ad15e6b3d6..be86481c3c 100644
--- a/dev/VSIX/ProjectTemplates/Desktop/CSharp/NavigationApp/ProjectTemplate.csproj
+++ b/dev/VSIX/ProjectTemplates/Desktop/CSharp/NavigationApp/ProjectTemplate.csproj
@@ -11,6 +11,7 @@
true
false
true
+ enable
enable
@@ -38,11 +39,12 @@
-
+
diff --git a/dev/VSIX/ProjectTemplates/Desktop/CSharp/UnitTestApp/ProjectTemplate.csproj b/dev/VSIX/ProjectTemplates/Desktop/CSharp/UnitTestApp/ProjectTemplate.csproj
index 6d34a36d8e..9afae2848e 100644
--- a/dev/VSIX/ProjectTemplates/Desktop/CSharp/UnitTestApp/ProjectTemplate.csproj
+++ b/dev/VSIX/ProjectTemplates/Desktop/CSharp/UnitTestApp/ProjectTemplate.csproj
@@ -11,6 +11,7 @@
true
false
true
+ enable
enable
diff --git a/dev/VSIX/ProjectTemplates/Desktop/CSharp/UnitTestApp/UnitTestApp.xaml.cs b/dev/VSIX/ProjectTemplates/Desktop/CSharp/UnitTestApp/UnitTestApp.xaml.cs
index b6eefff4f8..f403c53bbb 100644
--- a/dev/VSIX/ProjectTemplates/Desktop/CSharp/UnitTestApp/UnitTestApp.xaml.cs
+++ b/dev/VSIX/ProjectTemplates/Desktop/CSharp/UnitTestApp/UnitTestApp.xaml.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Runtime.InteropServices.WindowsRuntime;
-using Windows.ApplicationModel;
+using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
diff --git a/dev/VSIX/ProjectTemplates/Desktop/CSharp/UnitTestApp/UnitTestAppWindow.xaml.cs b/dev/VSIX/ProjectTemplates/Desktop/CSharp/UnitTestApp/UnitTestAppWindow.xaml.cs
index b3db8f9eda..b4a66a02eb 100644
--- a/dev/VSIX/ProjectTemplates/Desktop/CSharp/UnitTestApp/UnitTestAppWindow.xaml.cs
+++ b/dev/VSIX/ProjectTemplates/Desktop/CSharp/UnitTestApp/UnitTestAppWindow.xaml.cs
@@ -1,8 +1,3 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Microsoft.UI.Xaml;
diff --git a/dev/VSIX/ProjectTemplates/Desktop/CSharp/UnitTestApp/UnitTests.cs b/dev/VSIX/ProjectTemplates/Desktop/CSharp/UnitTestApp/UnitTests.cs
index 58f0b468f9..3963e7486e 100644
--- a/dev/VSIX/ProjectTemplates/Desktop/CSharp/UnitTestApp/UnitTests.cs
+++ b/dev/VSIX/ProjectTemplates/Desktop/CSharp/UnitTestApp/UnitTests.cs
@@ -1,9 +1,6 @@
using Microsoft.UI.Xaml.Controls;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.VisualStudio.TestTools.UnitTesting.AppContainer;
-using System;
-using System.Collections.Generic;
-using System.Linq;
namespace $safeprojectname$;
From 8bd2f061e9c87f662856925df4727ed1b2212682 Mon Sep 17 00:00:00 2001
From: Nikola Metulev <711864+nmetulev@users.noreply.github.com>
Date: Mon, 30 Mar 2026 16:32:56 -0700
Subject: [PATCH 3/3] adding mvvm template
---
dev/VSIX/DotnetNewTemplates/README.md | 1 +
...WinAppSdk.CSharp.DotnetNewTemplates.csproj | 27 +++
.../mvvm-app/.template.config/template.json | 197 ++++++++++++++++++
.../Desktop/CSharp/MvvmApp/App.xaml | 16 ++
.../Desktop/CSharp/MvvmApp/App.xaml.cs | 57 +++++
.../Desktop/CSharp/MvvmApp/MainPage.xaml | 19 ++
.../Desktop/CSharp/MvvmApp/MainPage.xaml.cs | 20 ++
.../Desktop/CSharp/MvvmApp/MainWindow.xaml | 34 +++
.../Desktop/CSharp/MvvmApp/MainWindow.xaml.cs | 27 +++
.../CSharp/MvvmApp/ProjectTemplate.csproj | 66 ++++++
.../MvvmApp/ViewModels/MainPageViewModel.cs | 21 ++
11 files changed, 485 insertions(+)
create mode 100644 dev/VSIX/DotnetNewTemplates/templates/mvvm-app/.template.config/template.json
create mode 100644 dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/App.xaml
create mode 100644 dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/App.xaml.cs
create mode 100644 dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/MainPage.xaml
create mode 100644 dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/MainPage.xaml.cs
create mode 100644 dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/MainWindow.xaml
create mode 100644 dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/MainWindow.xaml.cs
create mode 100644 dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/ProjectTemplate.csproj
create mode 100644 dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/ViewModels/MainPageViewModel.cs
diff --git a/dev/VSIX/DotnetNewTemplates/README.md b/dev/VSIX/DotnetNewTemplates/README.md
index 9304b1e9d1..30f17ac859 100644
--- a/dev/VSIX/DotnetNewTemplates/README.md
+++ b/dev/VSIX/DotnetNewTemplates/README.md
@@ -20,6 +20,7 @@ dotnet new install Microsoft.WindowsAppSDK.WinUI.CSharp.Templates
| Short Name | Description |
|------------------|----------------------------------------------------------|
| `winui` | WinUI 3 blank app with single-project MSIX packaging |
+| `winui-mvvm` | WinUI 3 MVVM app with CommunityToolkit.Mvvm |
| `winui-navview` | WinUI 3 NavigationView starter app |
| `winui-lib` | WinUI 3 class library for sharing UI components |
| `winui-unittest` | WinUI 3 packaged test app configured for MSTest |
diff --git a/dev/VSIX/DotnetNewTemplates/WinAppSdk.CSharp.DotnetNewTemplates.csproj b/dev/VSIX/DotnetNewTemplates/WinAppSdk.CSharp.DotnetNewTemplates.csproj
index a92e99cf78..6bcbef86a1 100644
--- a/dev/VSIX/DotnetNewTemplates/WinAppSdk.CSharp.DotnetNewTemplates.csproj
+++ b/dev/VSIX/DotnetNewTemplates/WinAppSdk.CSharp.DotnetNewTemplates.csproj
@@ -107,6 +107,33 @@
PackagePath="content/winui.unittest/gitignore.txt" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/App.xaml.cs b/dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/App.xaml.cs
new file mode 100644
index 0000000000..8470b455b7
--- /dev/null
+++ b/dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/App.xaml.cs
@@ -0,0 +1,57 @@
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+// To learn more about WinUI, the WinUI project structure,
+// and more about our project templates, see: http://aka.ms/winui-project-info.
+
+namespace $safeprojectname$;
+
+///
+/// Provides application-specific behavior to supplement the default Application class.
+///
+public partial class App : Application
+{
+ ///
+ /// The main application window. Use App.Window from any class that needs
+ /// the window reference (for dialogs, pickers, interop, etc.).
+ ///
+ public static Window Window { get; private set; } = null!;
+
+ ///
+ /// The UI thread dispatcher. Use App.DispatcherQueue to marshal calls
+ /// to the UI thread. Fully qualified to avoid CS0104 ambiguity with
+ /// .
+ ///
+ public static Microsoft.UI.Dispatching.DispatcherQueue DispatcherQueue { get; private set; } = null!;
+
+ ///
+ /// The native window handle (HWND). Use for file pickers,
+ /// DataTransferManager, and any WinRT interop that requires
+ /// InitializeWithWindow.
+ ///
+ public static nint WindowHandle =>
+ WinRT.Interop.WindowNative.GetWindowHandle(Window);
+
+ ///
+ /// Initializes the singleton application object.
+ ///
+ public App()
+ {
+ InitializeComponent();
+ }
+
+ ///
+ /// Invoked when the application is launched.
+ ///
+ /// Details about the launch request and process.
+ protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
+ {
+ Window = new MainWindow();
+ DispatcherQueue = Microsoft.UI.Dispatching.DispatcherQueue.GetForCurrentThread();
+ Window.Activate();
+ }
+}
diff --git a/dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/MainPage.xaml b/dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/MainPage.xaml
new file mode 100644
index 0000000000..73c07af389
--- /dev/null
+++ b/dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/MainPage.xaml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
diff --git a/dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/MainPage.xaml.cs b/dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/MainPage.xaml.cs
new file mode 100644
index 0000000000..352f251a18
--- /dev/null
+++ b/dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/MainPage.xaml.cs
@@ -0,0 +1,20 @@
+using Microsoft.UI.Xaml.Controls;
+using $safeprojectname$.ViewModels;
+
+// To learn more about WinUI, the WinUI project structure,
+// and more about our project templates, see: http://aka.ms/winui-project-info.
+
+namespace $safeprojectname$;
+
+///
+/// The main content page displayed inside the application window.
+///
+public sealed partial class MainPage : Page
+{
+ public MainPageViewModel ViewModel { get; } = new();
+
+ public MainPage()
+ {
+ InitializeComponent();
+ }
+}
diff --git a/dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/MainWindow.xaml b/dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/MainWindow.xaml
new file mode 100644
index 0000000000..29974c45fd
--- /dev/null
+++ b/dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/MainWindow.xaml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/MainWindow.xaml.cs b/dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/MainWindow.xaml.cs
new file mode 100644
index 0000000000..fc24f9ed43
--- /dev/null
+++ b/dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/MainWindow.xaml.cs
@@ -0,0 +1,27 @@
+using Microsoft.UI.Xaml;
+
+// To learn more about WinUI, the WinUI project structure,
+// and more about our project templates, see: http://aka.ms/winui-project-info.
+
+namespace $safeprojectname$;
+
+///
+/// The application window. This hosts a Frame that displays pages. Add your
+/// UI and logic to MainPage.xaml / MainPage.xaml.cs instead of here so you
+/// can use Page features such as navigation events and the Loaded lifecycle.
+///
+public sealed partial class MainWindow : Window
+{
+ public MainWindow()
+ {
+ InitializeComponent();
+
+ ExtendsContentIntoTitleBar = true;
+ SetTitleBar(AppTitleBar);
+
+ AppWindow.SetIcon("Assets/AppIcon.ico");
+
+ // Navigate the root frame to the main page on startup.
+ RootFrame.Navigate(typeof(MainPage));
+ }
+}
diff --git a/dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/ProjectTemplate.csproj b/dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/ProjectTemplate.csproj
new file mode 100644
index 0000000000..0c87e58932
--- /dev/null
+++ b/dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/ProjectTemplate.csproj
@@ -0,0 +1,66 @@
+
+
+ WinExe
+ $DotNetVersion$-windows10.0.26100.0
+ 10.0.17763.0
+ $safeprojectname$
+ app.manifest
+ x86;x64;ARM64
+ win-x86;win-x64;win-arm64
+ win-$(Platform).pubxml
+ true
+ false
+ true
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ False
+ True
+ False
+ True
+
+
diff --git a/dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/ViewModels/MainPageViewModel.cs b/dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/ViewModels/MainPageViewModel.cs
new file mode 100644
index 0000000000..bf43f63aec
--- /dev/null
+++ b/dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/ViewModels/MainPageViewModel.cs
@@ -0,0 +1,21 @@
+using CommunityToolkit.Mvvm.ComponentModel;
+using CommunityToolkit.Mvvm.Input;
+
+namespace $safeprojectname$.ViewModels;
+
+///
+/// Sample ViewModel using CommunityToolkit.Mvvm partial property syntax.
+/// Uses for change notification and
+/// for command binding.
+///
+public partial class MainPageViewModel : ObservableObject
+{
+ [ObservableProperty]
+ public partial string Greeting { get; set; } = "Hello, WinUI!";
+
+ [RelayCommand]
+ private void UpdateGreeting()
+ {
+ Greeting = $"Updated at {DateTime.Now:T}";
+ }
+}