{"id":1134,"date":"2026-05-12T03:15:13","date_gmt":"2026-05-12T10:15:13","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/ifdef-windows\/?p=1134"},"modified":"2026-05-12T05:28:28","modified_gmt":"2026-05-12T12:28:28","slug":"introducing-dotnet-new-templates-for-winui","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/ifdef-windows\/introducing-dotnet-new-templates-for-winui\/","title":{"rendered":"Introducing dotnet new WinUI templates"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p><figure id=\"attachment_1143\" aria-labelledby=\"figcaption_attachment_1143\" class=\"wp-caption alignnone\" ><a href=\"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/dotnetNewSocialMediaImage-Custom.webp\"><img decoding=\"async\" class=\"size-full wp-image-1143\" src=\"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/dotnetNewSocialMediaImage-Custom.webp\" alt=\"Introducing dotnet new templates for WinUI\" width=\"1188\" height=\"622\" srcset=\"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/dotnetNewSocialMediaImage-Custom.webp 1188w, https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/dotnetNewSocialMediaImage-Custom-300x157.webp 300w, https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/dotnetNewSocialMediaImage-Custom-1024x536.webp 1024w, https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/dotnetNewSocialMediaImage-Custom-768x402.webp 768w\" sizes=\"(max-width: 1188px) 100vw, 1188px\" \/><\/a><figcaption id=\"figcaption_attachment_1143\" class=\"wp-caption-text\">Introducing dotnet new templates for WinUI<\/figcaption><\/figure><\/p>\n<p>We&#8217;ve been working on something new for WinUI developers: <strong><a href=\"https:\/\/github.com\/microsoft\/WindowsAppSDK\/pull\/6407\">a set of open-source project and item templates for WinUI<\/a> you can use directly from the command line.<\/strong> \ud83d\ude80<\/p>\n<p>With these templates, you can now <strong>create and run a new WinUI app using <code>dotnet new<\/code>, without needing to go through Visual Studio<\/strong>. This makes it easier to get started quickly, script your setup, use VS Code or other editors for development, or integrate WinUI into your existing workflows.<\/p>\n<p>These templates <strong>are currently in preview<\/strong>, and were developed based on the <a href=\"https:\/\/github.com\/microsoft\/microsoft-ui-xaml\/issues\/10388\">feedback by the community<\/a>. We&#8217;re working on bringing them into Visual Studio so you\u2019ll get the same experience there.<\/p>\n<h2><strong>Getting started \ud83d\ude80<\/strong><\/h2>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\"># Install the templates\r\ndotnet new install Microsoft.WindowsAppSDK.WinUI.CSharp.Templates\r\n\r\n# List all the templates\r\ndotnet new list winui \r\n\r\n# Create a new WinUI app using a NavigationView\r\ndotnet new winui-navview -n MyApp \r\n\r\n# Run the app\r\ncd MyApp\r\ndotnet run<\/code><\/pre>\n<h2><strong>\ud83c\udfa8 Built with Windows app silhouettes in mind\u00a0<\/strong><\/h2>\n<p>All templates are designed around the <a href=\"https:\/\/learn.microsoft.com\/windows\/apps\/design\/basics\/app-silhouette\">Windows app silhouettes<\/a>. That means they follow modern Fluent Design patterns out of the box, including layout, navigation, and visual structure.<\/p>\n<p>We also updated some of the defaults to better match modern Windows apps. For example, the <strong>default app icon has been refreshed<\/strong> and we now include <strong>an .ico asset by default<\/strong>, so your app looks right from the start in both light and dark mode.<\/p>\n<h2><strong>\u26a1 New templates making your more productive<\/strong><\/h2>\n<h4><strong>Blank template<\/strong><\/h4>\n<p>The Blank WinUI app template gives you a clean starting point, but with a few important upgrades.\u00a0It includes a modern title bar control, so your app already looks Fluent in both light and dark mode. Combined with the updated icon and defaults, this gives you a much more polished starting experience compared to older templates.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/BlankApp-3.webp\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1120\" src=\"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/BlankApp-3.webp\" alt=\"Blank app template\" width=\"1689\" height=\"1074\" srcset=\"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/BlankApp-3.webp 1689w, https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/BlankApp-3-300x191.webp 300w, https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/BlankApp-3-1024x651.webp 1024w, https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/BlankApp-3-768x488.webp 768w, https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/BlankApp-3-1536x977.webp 1536w\" sizes=\"(max-width: 1689px) 100vw, 1689px\" \/><\/a><\/p>\n<p>To use this template, simply use:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">dotnet new winui -n MyApp<\/code><\/pre>\n<h4><strong>NavigationView template<\/strong><\/h4>\n<p>The NavigationView template is based on the familiar master detail pattern. It includes a fully wired up NavigationView, a modern title bar, and a basic navigation structure so you can start building multi page apps right away. It follows the standard Windows app silhouette for navigation based apps, making it a great starting point for many scenarios.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/NavView.webp\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1121\" src=\"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/NavView.webp\" alt=\"NavigationView template\" width=\"1687\" height=\"1088\" srcset=\"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/NavView.webp 1687w, https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/NavView-300x193.webp 300w, https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/NavView-1024x660.webp 1024w, https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/NavView-768x495.webp 768w, https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/NavView-1536x991.webp 1536w\" sizes=\"(max-width: 1687px) 100vw, 1687px\" \/><\/a><\/p>\n<p>To use this template, simply use:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">dotnet new winui-navview -n MyApp<\/code><\/pre>\n<h4><strong>TabView template<\/strong><\/h4>\n<p>The TabView template provides a UI silhouette centered around tabs.\u00a0Out of the box, you get support for adding, removing, and dragging tabs, along with a layout that feels right at home on Windows. This is a great fit for apps that need to manage multiple documents or views at the same time.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/TabView.webp\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1123\" src=\"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/TabView.webp\" alt=\"TabView template\" width=\"1687\" height=\"1075\" srcset=\"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/TabView.webp 1687w, https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/TabView-300x191.webp 300w, https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/TabView-1024x653.webp 1024w, https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/TabView-768x489.webp 768w, https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/TabView-1536x979.webp 1536w\" sizes=\"(max-width: 1687px) 100vw, 1687px\" \/><\/a><\/p>\n<p>To use this template, simply use:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">dotnet new winui-tabview -n MyApp<\/code><\/pre>\n<h4><strong>MVVM template<\/strong><\/h4>\n<p>The WinUI MVVM template <strong>helps you get started with the <a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/communitytoolkit\/mvvm\/\">Model View ViewModel pattern<\/a><\/strong> right away.<\/p>\n<p>It includes a simple working example and the basic structure you need to build apps using MVVM, so you don\u2019t have to wire everything up from scratch. This makes it easier to follow best practices from the start while still keeping things lightweight and easy to understand.<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">dotnet new winui-mvvm -n MyApp<\/code><\/pre>\n<h4><a href=\"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/Mvvm.webp\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1145\" src=\"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/Mvvm.webp\" alt=\"Mvvm template\" width=\"1687\" height=\"1075\" srcset=\"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/Mvvm.webp 1687w, https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/Mvvm-300x191.webp 300w, https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/Mvvm-1024x653.webp 1024w, https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/Mvvm-768x489.webp 768w, https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/Mvvm-1536x979.webp 1536w\" sizes=\"(max-width: 1687px) 100vw, 1687px\" \/><\/a><\/p>\n<p>Item templates<\/h4>\n<p>In addition to project templates, we\u2019ve added a set of item templates to make it easy to add common building blocks to an existing app &#8211; like new pages, windows, user controls, templated controls, resource dictionaries, and dialogs.<\/p>\n<p>You can list all available item templates with (inside a project directory):<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">dotnet new list winui<\/code><\/pre>\n<p>Here\u2019s an example of adding a ContentDialog to your app:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/ContentDialog-3.webp\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1124\" src=\"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/ContentDialog-3.webp\" alt=\"App with a content dialog\" width=\"882\" height=\"644\" srcset=\"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/ContentDialog-3.webp 882w, https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/ContentDialog-3-300x219.webp 300w, https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/ContentDialog-3-768x561.webp 768w\" sizes=\"(max-width: 882px) 100vw, 882px\" \/><\/a><\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">dotnet new winui -n MyApp\r\ncd MyApp\r\ndotnet new winui-dialog -n MyDialog<\/code><\/pre>\n<h3>\ud83d\ude80 Run packaged WinUI apps directly with dotnet run<\/h3>\n<p>All of the new project templates reference the <a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.Windows.SDK.BuildTools.WinApp\">Microsoft.Windows.SDK.BuildTools.WinApp<\/a> NuGet package by default. That means you can build and launch your app <strong>fully packaged, with package identity, straight from the command line<\/strong> &#8211; no Visual Studio or manual <code>Add-AppxPackage<\/code> required. Just run <code>dotnet run<\/code> and the WinApp CLI takes care of registering the loose-layout package and launching it for you.<\/p>\n<p>To learn more about WinApp\u00a0CLI and <code>dotnet run<\/code> support for packaged apps, check out the <a href=\"https:\/\/devblogs.microsoft.com\/ifdef-windows\/windows-app-development-cli-v0-3-new-run-and-ui-commands-plus-dotnet-run-support-for-packaged-apps\/\">Windows App Development CLI v0.3 announcement<\/a>.<\/p>\n<h3>\ud83d\udce2 Also coming to Visual Studio 2026<\/h3>\n<p>We&#8217;re actively working with the Visual Studio team to bring these templates into Visual Studio as well, so you&#8217;ll be able to create the same experiences in Visual Studio too.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/VisualStudio.webp\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1125\" src=\"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/VisualStudio.webp\" alt=\"New templates as part of Visual Studio\" width=\"1134\" height=\"785\" srcset=\"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/VisualStudio.webp 1134w, https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/VisualStudio-300x208.webp 300w, https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/VisualStudio-1024x709.webp 1024w, https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-content\/uploads\/sites\/61\/2026\/05\/VisualStudio-768x532.webp 768w\" sizes=\"(max-width: 1134px) 100vw, 1134px\" \/><\/a><\/p>\n<h3><strong>Try them out and give feedback<\/strong><\/h3>\n<p>These templates are <strong>open source and in preview<\/strong>, and <a href=\"https:\/\/github.com\/microsoft\/WindowsAppSDK\/issues\/new\">we&#8217;d love your feedback<\/a>. If something feels off or you have ideas for improvements, feel free to jump in and contribute.<\/p>\n<p>Give them a try and let us know what you think!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; We&#8217;ve been working on something new for WinUI developers: a set of open-source project and item templates for WinUI you can use directly from the command line. \ud83d\ude80 With these templates, you can now create and run a new WinUI app using dotnet new, without needing to go through Visual Studio. This makes it [&hellip;]<\/p>\n","protected":false},"author":128482,"featured_media":1143,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1,71],"tags":[51,49,84,83,6,77,7],"class_list":["post-1134","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ifdef-windows","category-windows-app-development-cli","tag-csharp","tag-dotnet","tag-visual-studio","tag-winappsdk","tag-winui","tag-winui-gallery","tag-winui3"],"acf":[],"blog_post_summary":"<p>&nbsp; We&#8217;ve been working on something new for WinUI developers: a set of open-source project and item templates for WinUI you can use directly from the command line. \ud83d\ude80 With these templates, you can now create and run a new WinUI app using dotnet new, without needing to go through Visual Studio. This makes it [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-json\/wp\/v2\/posts\/1134","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-json\/wp\/v2\/users\/128482"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-json\/wp\/v2\/comments?post=1134"}],"version-history":[{"count":2,"href":"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-json\/wp\/v2\/posts\/1134\/revisions"}],"predecessor-version":[{"id":1147,"href":"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-json\/wp\/v2\/posts\/1134\/revisions\/1147"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-json\/wp\/v2\/media\/1143"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-json\/wp\/v2\/media?parent=1134"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-json\/wp\/v2\/categories?post=1134"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/ifdef-windows\/wp-json\/wp\/v2\/tags?post=1134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}