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 58f2607305..6bcbef86a1 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,36 @@ + + + + + + + + + + + + + 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/mvvm-app/.template.config/template.json b/dev/VSIX/DotnetNewTemplates/templates/mvvm-app/.template.config/template.json new file mode 100644 index 0000000000..f084412ecd --- /dev/null +++ b/dev/VSIX/DotnetNewTemplates/templates/mvvm-app/.template.config/template.json @@ -0,0 +1,197 @@ +{ + "$schema": "https://json.schemastore.org/template", + "author": "Microsoft", + "classifications": ["Windows", "WinUI", "Desktop", "MVVM"], + "tags": { + "language": "C#", + "type": "project" + }, + "identity": "Microsoft.WindowsAppSDK.WinUI.CSharp.MvvmApp", + "groupIdentity": "Microsoft.WindowsAppSDK.WinUI.CSharp.MvvmApp", + "name": "WinUI MVVM App", + "shortName": ["winui-mvvm", "winui3-mvvm"], + "sourceName": "ProjectTemplate", + "defaultName": "WinUIMvvmApp", + "description": "Creates a WinUI 3 desktop app with MVVM pattern using CommunityToolkit.Mvvm.", + "preferNameDirectory": true, + "constraints": { + "windows-only": { + "type": "os", + "args": "Windows" + }, + "sdk-version": { + "type": "sdk-version", + "args": [ "[8.0,)" ] + } + }, + "symbols": { + "safeProjectName": { + "type": "derived", + "valueSource": "name", + "valueTransform": "safe_name", + "replaces": "$safeprojectname$" + }, + "projectName": { + "type": "derived", + "valueSource": "name", + "valueTransform": "identity", + "replaces": "$projectname$" + }, + "cliVersion": { + "type": "bind", + "binding": "host:dotnet-cli-version", + "defaultValue": "10.0.100" + }, + "autoDetectedTfm": { + "type": "generated", + "generator": "regex", + "datatype": "string", + "parameters": { + "source": "cliVersion", + "steps": [ + { + "regex": "^(\\d+)\\..*$", + "replacement": "net${1}.0" + } + ] + } + }, + "dotnetVersion": { + "type": "parameter", + "datatype": "choice", + "description": "Base target framework moniker (TFM) for the WinUI project. Defaults to the installed SDK version.", + "choices": [ + { "choice": "net8.0", "description": "Target .NET 8" }, + { "choice": "net9.0", "description": "Target .NET 9" }, + { "choice": "net10.0", "description": "Target .NET 10" } + ] + }, + "resolvedDotnetVersion": { + "type": "generated", + "generator": "coalesce", + "parameters": { + "sourceVariableName": "dotnetVersion", + "fallbackVariableName": "autoDetectedTfm" + }, + "replaces": "$DotNetVersion$" + }, + "targetPlatformMinVersion":{ + "type": "parameter", + "datatype": "text", + "replaces": "$targetplatformminversion$", + "defaultValue": "10.0.17763.0", + "description": "Minimum supported Windows version." + }, + "publisherDn": { + "type": "parameter", + "datatype": "text", + "replaces": "$XmlEscapedPublisherDistinguishedName$", + "defaultValue": "CN=AppPublisher", + "description": "Publisher distinguished name used inside Package.appxmanifest." + }, + "publisherDisplay": { + "type": "parameter", + "datatype": "text", + "replaces": "$XmlEscapedPublisher$", + "defaultValue": "AppPublisher", + "description": "Publisher display name shown in the manifest and Settings page." + }, + "guid9": { + "type": "generated", + "generator": "guid", + "parameters": { + "format": "D" + }, + "replaces": "$guid9$" + }, + "UseLatestWindowsAppSDK":{ + "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": [ + { + "modifiers": [ + { + "replacements": [ + { + "before": "$targetnametoken$", + "after": "{{safeProjectName}}" + }, + { + "before": "$targetentrypoint$", + "after": "{{safeProjectName}}.App" + } + ] + } + ], + "rename": { + "gitignore.txt": ".gitignore" + } + } + ], + "primaryOutputs": [ + { "path": "ProjectTemplate.csproj" } + ], + "forms": { + "safe_name": { + "identifier": "safe_name" + }, + "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": "B17581D1-C5C9-4489-8F0A-004BE667B814", + "continueOnError": true, + "description": "Update CommunityToolkit.Mvvm to the latest stable version.", + "args": { + "referenceType": "package", + "reference": "CommunityToolkit.Mvvm" + }, + "manualInstructions": [{ "text": "Run 'dotnet add package CommunityToolkit.Mvvm'" }] + }, + { + "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/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/MvvmApp/App.xaml b/dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/App.xaml new file mode 100644 index 0000000000..65073698c1 --- /dev/null +++ b/dev/VSIX/ProjectTemplates/Desktop/CSharp/MvvmApp/App.xaml @@ -0,0 +1,16 @@ + + + + + + + + + + + + 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 @@ + + + + + +