Skip to content

Commit a48d98b

Browse files
Project template for WPF (#489)
* Add WPF project template
1 parent 2b56364 commit a48d98b

File tree

10 files changed

+243
-0
lines changed

10 files changed

+243
-0
lines changed

Microsoft.Dotnet.Wpf.sln

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Microsoft.DotNet.Arcade.Wpf
1717
EndProject
1818
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Arcade.Wpf.Sdk.ArchNeutral", "packaging\Microsoft.DotNet.Arcade.Wpf.Sdk\Microsoft.DotNet.Arcade.Wpf.Sdk.ArchNeutral.csproj", "{B73BB4AB-68DE-4B91-BBB0-AB4F2D504AC3}"
1919
EndProject
20+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Wpf.ProjectTemplates.ArchNeutral", "packaging\Microsoft.Dotnet.Wpf.ProjectTemplates\Microsoft.DotNet.Wpf.ProjectTemplates.ArchNeutral.csproj", "{BFF6C118-3369-43B5-ACA6-D65ED00EEBE0}"
21+
EndProject
2022
Global
2123
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2224
Debug|Any CPU = Debug|Any CPU
@@ -75,6 +77,18 @@ Global
7577
{B73BB4AB-68DE-4B91-BBB0-AB4F2D504AC3}.Release|x64.Build.0 = Release|x64
7678
{B73BB4AB-68DE-4B91-BBB0-AB4F2D504AC3}.Release|x86.ActiveCfg = Release|Any CPU
7779
{B73BB4AB-68DE-4B91-BBB0-AB4F2D504AC3}.Release|x86.Build.0 = Release|Any CPU
80+
{BFF6C118-3369-43B5-ACA6-D65ED00EEBE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
81+
{BFF6C118-3369-43B5-ACA6-D65ED00EEBE0}.Debug|Any CPU.Build.0 = Debug|Any CPU
82+
{BFF6C118-3369-43B5-ACA6-D65ED00EEBE0}.Debug|x64.ActiveCfg = Debug|x64
83+
{BFF6C118-3369-43B5-ACA6-D65ED00EEBE0}.Debug|x64.Build.0 = Debug|x64
84+
{BFF6C118-3369-43B5-ACA6-D65ED00EEBE0}.Debug|x86.ActiveCfg = Debug|Any CPU
85+
{BFF6C118-3369-43B5-ACA6-D65ED00EEBE0}.Debug|x86.Build.0 = Debug|Any CPU
86+
{BFF6C118-3369-43B5-ACA6-D65ED00EEBE0}.Release|Any CPU.ActiveCfg = Release|Any CPU
87+
{BFF6C118-3369-43B5-ACA6-D65ED00EEBE0}.Release|Any CPU.Build.0 = Release|Any CPU
88+
{BFF6C118-3369-43B5-ACA6-D65ED00EEBE0}.Release|x64.ActiveCfg = Release|x64
89+
{BFF6C118-3369-43B5-ACA6-D65ED00EEBE0}.Release|x64.Build.0 = Release|x64
90+
{BFF6C118-3369-43B5-ACA6-D65ED00EEBE0}.Release|x86.ActiveCfg = Release|Any CPU
91+
{BFF6C118-3369-43B5-ACA6-D65ED00EEBE0}.Release|x86.Build.0 = Release|Any CPU
7892
EndGlobalSection
7993
GlobalSection(SolutionProperties) = preSolution
8094
HideSolutionNode = FALSE
@@ -85,6 +99,7 @@ Global
8599
{9A7E395B-E859-40E2-809D-EFB72CF3A2EE} = {BF20132A-191F-4D34-9A1B-831772A6DFCF}
86100
{8A2ABE39-2D50-48CA-AC32-078BBA32757A} = {0159B0F1-0626-4BED-8D1B-CBFF4F12C369}
87101
{B73BB4AB-68DE-4B91-BBB0-AB4F2D504AC3} = {8A2ABE39-2D50-48CA-AC32-078BBA32757A}
102+
{BFF6C118-3369-43B5-ACA6-D65ED00EEBE0} = {0159B0F1-0626-4BED-8D1B-CBFF4F12C369}
88103
EndGlobalSection
89104
GlobalSection(ExtensibilityGlobals) = postSolution
90105
SolutionGuid = {D4D12991-F531-4FC3-849D-29946BCA818A}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<ProjectGuid>{BFF6C118-3369-43B5-ACA6-D65ED00EEBE0}</ProjectGuid>
4+
<TargetFramework>netcoreapp3.0</TargetFramework>
5+
<Platforms>AnyCPU;x64</Platforms>
6+
<IsShippingPackage>true</IsShippingPackage>
7+
<VersionPrefix>3.0.0</VersionPrefix>
8+
</PropertyGroup>
9+
10+
<PropertyGroup>
11+
<!--
12+
PlatformIndependentPackage = true means that this package does
13+
not require the automatic generation of a runtime.json file using
14+
the Bait & Switch technique to reference RID specific packages
15+
-->
16+
<PlatformIndependentPackage>true</PlatformIndependentPackage>
17+
</PropertyGroup>
18+
19+
<PropertyGroup>
20+
<PackageName>$(MSBuildProjectName.Replace('.ArchNeutral',''))</PackageName>
21+
<AssemblyName>$(PackageName)</AssemblyName>
22+
<PackageDescription>Project templates for .NET Core WPF Projects</PackageDescription>
23+
</PropertyGroup>
24+
25+
<ItemGroup>
26+
<PackagingContent Include="useSharedDesignerContext.txt" SubFolder="root" />
27+
<PackagingContent Include="content\**\*" SubFolder="root\%(RecursiveDir)" />
28+
</ItemGroup>
29+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"$schema": "http://json.schemastore.org/dotnetcli.host",
3+
"symbolInfo": {
4+
"TargetFrameworkOverride": {
5+
"isHidden": "true",
6+
"longName": "target-framework-override",
7+
"shortName": ""
8+
},
9+
"Framework": {
10+
"longName": "framework"
11+
},
12+
"skipRestore": {
13+
"longName": "no-restore",
14+
"shortName": ""
15+
},
16+
"langVersion": {
17+
"longName": "langVersion",
18+
"shortName": ""
19+
}
20+
},
21+
"usageExamples": [
22+
""
23+
]
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"$schema": "http://json.schemastore.org/template",
3+
"author": "Microsoft",
4+
"classifications": ["Common", "WPF"],
5+
"name": "WPF Application",
6+
"generatorVersions": "[1.0.0.0-*)",
7+
"description": "A project for creating a .NET Core WPF Application",
8+
"groupIdentity": "Microsoft.Common.WPF",
9+
"precedence": "3000",
10+
"identity": "Microsoft.Common.WPF",
11+
"shortName": "wpf",
12+
"tags": {
13+
"language": "C#",
14+
"type": "project"
15+
},
16+
"sourceName": "Company.WpfApplication1",
17+
"preferNameDirectory": true,
18+
"symbols": {
19+
"TargetFrameworkOverride": {
20+
"type": "parameter",
21+
"description": "Overrides the target framework",
22+
"replaces": "TargetFrameworkOverride",
23+
"datatype": "string",
24+
"defaultValue": ""
25+
},
26+
"Framework": {
27+
"type": "parameter",
28+
"description": "The target framework for the project.",
29+
"datatype": "choice",
30+
"choices": [
31+
{
32+
"choice": "netcoreapp3.0",
33+
"description": "Target netcoreapp3.0"
34+
}
35+
],
36+
"replaces": "netcoreapp3.0",
37+
"defaultValue": "netcoreapp3.0"
38+
},
39+
"langVersion": {
40+
"type": "parameter",
41+
"datatype": "text",
42+
"description": "Sets langVersion in the created project file",
43+
"defaultValue": "",
44+
"replaces": "$(ProjectLanguageVersion)"
45+
},
46+
"HostIdentifier": {
47+
"type": "bind",
48+
"binding": "HostIdentifier"
49+
},
50+
"skipRestore": {
51+
"type": "parameter",
52+
"datatype": "bool",
53+
"description": "If specified, skips the automatic restore of the project on create.",
54+
"defaultValue": "false"
55+
}
56+
},
57+
"primaryOutputs": [
58+
{ "path": "Company.WpfApplication1.csproj" },
59+
{
60+
"condition": "(HostIdentifier != \"dotnetcli\" && HostIdentifier != \"dotnetcli-preview\")",
61+
"path": "MainWindow.xaml.cs"
62+
}
63+
],
64+
"defaultName": "WpfApp1",
65+
"postActions": [
66+
{
67+
"condition": "(!skipRestore)",
68+
"description": "Restore NuGet packages required by this project.",
69+
"manualInstructions": [
70+
{ "text": "Run 'dotnet restore'" }
71+
],
72+
"actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
73+
"continueOnError": true
74+
},
75+
{
76+
"condition": "(HostIdentifier != \"dotnetcli\" && HostIdentifier != \"dotnetcli-preview\")",
77+
"description": "Opens MainWindow.xaml.cs in the editor",
78+
"manualInstructions": [ ],
79+
"actionId": "84C0DA21-51C8-4541-9940-6CA19AF04EE6",
80+
"args": {
81+
"files": "1"
82+
},
83+
"continueOnError": true
84+
}
85+
]
86+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Application x:Class="Company.WpfApplication1.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="clr-namespace:Company.WpfApplication1"
5+
StartupUri="MainWindow.xaml">
6+
<Application.Resources>
7+
8+
</Application.Resources>
9+
</Application>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Configuration;
4+
using System.Data;
5+
using System.Linq;
6+
using System.Threading.Tasks;
7+
using System.Windows;
8+
9+
namespace Company.WpfApplication1
10+
{
11+
/// <summary>
12+
/// Interaction logic for App.xaml
13+
/// </summary>
14+
public partial class App : Application
15+
{
16+
}
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
2+
3+
<PropertyGroup>
4+
<OutputType>WinExe</OutputType>
5+
<TargetFramework Condition="'$(TargetFrameworkOverride)' == ''">netcoreapp3.0</TargetFramework>
6+
<TargetFramework Condition="'$(TargetFrameworkOverride)' != ''">TargetFrameworkOverride</TargetFramework>
7+
<RootNamespace Condition="'$(name)' != '$(name{-VALUE-FORMS-}safe_namespace)'">Company.WpfApplication1</RootNamespace>
8+
<LangVersion Condition="'$(langVersion)' != ''">$(ProjectLanguageVersion)</LangVersion>
9+
<UseWPF>true</UseWPF>
10+
</PropertyGroup>
11+
12+
</Project>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Window x:Class="Company.WpfApplication1.MainWindow"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:local="clr-namespace:Company.WpfApplication1"
7+
mc:Ignorable="d"
8+
Title="MainWindow" Height="450" Width="800">
9+
<Grid>
10+
<Grid.RowDefinitions>
11+
<RowDefinition Height="9*"/>
12+
<RowDefinition Height="1*"/>
13+
</Grid.RowDefinitions>
14+
<Label Content="Hello .NET Core!" HorizontalAlignment="Center" VerticalAlignment="Center"
15+
FontSize="40"/>
16+
<Button Content="Exit" Grid.Row="1" FontSize="20" Click="ButtonExit_Click"/>
17+
</Grid>
18+
</Window>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.Windows;
7+
using System.Windows.Controls;
8+
using System.Windows.Data;
9+
using System.Windows.Documents;
10+
using System.Windows.Input;
11+
using System.Windows.Media;
12+
using System.Windows.Media.Imaging;
13+
using System.Windows.Navigation;
14+
using System.Windows.Shapes;
15+
16+
namespace Company.WpfApplication1
17+
{
18+
/// <summary>
19+
/// Interaction logic for MainWindow.xaml
20+
/// </summary>
21+
public partial class MainWindow : Window
22+
{
23+
public MainWindow()
24+
{
25+
InitializeComponent();
26+
}
27+
28+
private void ButtonExit_Click(object sender, RoutedEventArgs e)
29+
{
30+
Application.Current.Shutdown();
31+
}
32+
}
33+
}

packaging/Microsoft.Dotnet.Wpf.ProjectTemplates/useSharedDesignerContext.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)