diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/template.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/template.json index d6f9721afad..83c1f0aa828 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/template.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/template.json @@ -1,7 +1,7 @@ { "$schema": "http://json.schemastore.org/template", "author": "Microsoft", - "classifications": ["Common", "WinForms"], + "classifications": [ "Common", "WinForms" ], "name": "Windows Forms App", "generatorVersions": "[1.0.0.0-*)", "description": "A project template for creating a .NET Windows Forms (WinForms) App.", @@ -49,10 +49,6 @@ "defaultValue": "net6.0", "displayName": "Framework" }, - "UseWindowsDesktopSdk": { - "type": "computed", - "value": "(Framework == \"netcoreapp3.1\")" - }, "langVersion": { "type": "parameter", "datatype": "text", @@ -78,6 +74,23 @@ "defaultValue": "true", "description": "Whether to enable nullable reference types for this project.", "displayName": "Enable nullable" + }, + "csharp10orLater": { + "type": "generated", + "generator": "regexMatch", + "datatype": "bool", + "parameters": { + "pattern": "^(|10\\.0|10|preview|latest|default|latestMajor)$", + "source": "langVersion" + } + }, + "csharpFeature_ImplicitUsings": { + "type": "computed", + "value": "Framework == \"net6.0\" && csharp10orLater == \"true\"" + }, + "csharpFeature_FileScopedNamespaces": { + "type": "computed", + "value": "(Framework == \"net6.0\" || langVersion != \"\") && csharp10orLater == \"true\"" } }, "primaryOutputs": [ @@ -89,24 +102,19 @@ ], "sources": [ { - "exclude": [ "**/[Bb]in/**", "**/[Oo]bj/**", ".template.config/**/*", "**/*.filelist", "**/*.lock.json" ], - "modifiers": [ - { - "condition": "(UseWindowsDesktopSdk)", - "exclude": [ - "Company.WinFormsApplication1.csproj" - ], - "rename": { - "Company.WinFormsApplication3x1.csproj": "Company.WinFormsApplication1.csproj" - } - }, - { - "condition": "(!UseWindowsDesktopSdk)", - "exclude": [ - "Company.WinFormsApplication3x1.csproj" - ] - } - ] + "condition": "Framework == \"netcoreapp3.1\"", + "source": "./netcoreapp3.1", + "target": "./" + }, + { + "condition": "Framework == \"net5.0\"", + "source": "./net5.0", + "target": "./" + }, + { + "condition": "Framework == \"net6.0\"", + "source": "./net6.0", + "target": "./" } ], "defaultName": "WinFormsApp1", @@ -125,7 +133,7 @@ "id": "open-file", "condition": "(HostIdentifier != \"dotnetcli\" && HostIdentifier != \"dotnetcli-preview\")", "description": "Opens Form1.cs in the editor", - "manualInstructions": [ ], + "manualInstructions": [], "actionId": "84C0DA21-51C8-4541-9940-6CA19AF04EE6", "args": { "files": "1" diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/Company.WinFormsApplication1.csproj b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/net5.0/Company.WinFormsApplication1.csproj similarity index 100% rename from pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/Company.WinFormsApplication1.csproj rename to pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/net5.0/Company.WinFormsApplication1.csproj diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/Company.WinFormsApplication1.csproj.user b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/net5.0/Company.WinFormsApplication1.csproj.user similarity index 100% rename from pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/Company.WinFormsApplication1.csproj.user rename to pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/net5.0/Company.WinFormsApplication1.csproj.user diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/Form1.Designer.cs b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/net5.0/Form1.Designer.cs similarity index 99% rename from pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/Form1.Designer.cs rename to pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/net5.0/Form1.Designer.cs index 7bba2aa658a..5367110f5c4 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/Form1.Designer.cs +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/net5.0/Form1.Designer.cs @@ -37,4 +37,3 @@ private void InitializeComponent() #endregion } } - diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/Form1.cs b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/net5.0/Form1.cs similarity index 100% rename from pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/Form1.cs rename to pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/net5.0/Form1.cs diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/net6.0/Company.WinFormsApplication1.csproj b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/net6.0/Company.WinFormsApplication1.csproj new file mode 100644 index 00000000000..3bdcf361e98 --- /dev/null +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/net6.0/Company.WinFormsApplication1.csproj @@ -0,0 +1,14 @@ + + + + WinExe + FrameworkParameter-windows + TargetFrameworkOverride-windows + Company.WinFormsApplication1 + $(ProjectLanguageVersion) + enable + true + enable + + + \ No newline at end of file diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/net6.0/Company.WinFormsApplication1.csproj.user b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/net6.0/Company.WinFormsApplication1.csproj.user new file mode 100644 index 00000000000..7814ea24efb --- /dev/null +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/net6.0/Company.WinFormsApplication1.csproj.user @@ -0,0 +1,8 @@ + + + + + Form + + + diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/net6.0/Form1.Designer.cs b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/net6.0/Form1.Designer.cs new file mode 100644 index 00000000000..eb8b662216d --- /dev/null +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/net6.0/Form1.Designer.cs @@ -0,0 +1,80 @@ +#if (csharpFeature_FileScopedNamespaces) +namespace Company.WinFormsApplication1; + +partial class Form1 +{ + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Text = "Form1"; + } + + #endregion +} +#else +namespace Company.WinFormsApplication1 +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Text = "Form1"; + } + + #endregion + } +} +#endif diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/net6.0/Form1.cs b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/net6.0/Form1.cs new file mode 100644 index 00000000000..d1ac7561fe4 --- /dev/null +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/net6.0/Form1.cs @@ -0,0 +1,34 @@ +#if (!csharpFeature_ImplicitUsings) +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +#endif +#if (csharpFeature_FileScopedNamespaces) +namespace Company.WinFormsApplication1; + +public partial class Form1 : Form +{ + public Form1() + { + InitializeComponent(); + } +} +#else +namespace Company.WinFormsApplication1 +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + } +} +#endif diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/net6.0/Program.cs b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/net6.0/Program.cs new file mode 100644 index 00000000000..9c35cf13f9b --- /dev/null +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/net6.0/Program.cs @@ -0,0 +1,40 @@ +#if (!csharpFeature_ImplicitUsings) +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +#endif +#if (csharpFeature_FileScopedNamespaces) +namespace Company.WinFormsApplication1; + +static class Program +{ + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + ApplicationConfiguration.Initialize(); + Application.Run(new Form1()); + } +} +#else +namespace Company.WinFormsApplication1 +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + ApplicationConfiguration.Initialize(); + Application.Run(new Form1()); + } + } +} +#endif \ No newline at end of file diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/Company.WinFormsApplication3x1.csproj b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/netcoreapp3.1/Company.WinFormsApplication1.csproj similarity index 100% rename from pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/Company.WinFormsApplication3x1.csproj rename to pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/netcoreapp3.1/Company.WinFormsApplication1.csproj diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/netcoreapp3.1/Company.WinFormsApplication1.csproj.user b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/netcoreapp3.1/Company.WinFormsApplication1.csproj.user new file mode 100644 index 00000000000..7814ea24efb --- /dev/null +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/netcoreapp3.1/Company.WinFormsApplication1.csproj.user @@ -0,0 +1,8 @@ + + + + + Form + + + diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/netcoreapp3.1/Form1.Designer.cs b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/netcoreapp3.1/Form1.Designer.cs new file mode 100644 index 00000000000..5367110f5c4 --- /dev/null +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/netcoreapp3.1/Form1.Designer.cs @@ -0,0 +1,39 @@ +namespace Company.WinFormsApplication1 +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Text = "Form1"; + } + + #endregion + } +} diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/netcoreapp3.1/Form1.cs b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/netcoreapp3.1/Form1.cs new file mode 100644 index 00000000000..0ac1f900f5d --- /dev/null +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/netcoreapp3.1/Form1.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Company.WinFormsApplication1 +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + + } +} diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/Program.cs b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/netcoreapp3.1/Program.cs similarity index 100% rename from pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/Program.cs rename to pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/netcoreapp3.1/Program.cs diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/template.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/template.json index 61297b33801..01c160d369b 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/template.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/.template.config/template.json @@ -49,10 +49,6 @@ "defaultValue": "net6.0", "displayName": "Framework" }, - "UseWindowsDesktopSdk": { - "type": "computed", - "value": "(Framework == \"netcoreapp3.1\")" - }, "langVersion": { "type": "parameter", "datatype": "text", @@ -78,6 +74,23 @@ "defaultValue": "true", "description": "Whether to enable nullable reference types for this project.", "displayName": "Enable nullable" + }, + "csharp10orLater": { + "type": "generated", + "generator": "regexMatch", + "datatype": "bool", + "parameters": { + "pattern": "^(|10\\.0|10|preview|latest|default|latestMajor)$", + "source": "langVersion" + } + }, + "csharpFeature_ImplicitUsings": { + "type": "computed", + "value": "Framework == \"net6.0\" && csharp10orLater == \"true\"" + }, + "csharpFeature_FileScopedNamespaces": { + "type": "computed", + "value": "(Framework == \"net6.0\" || langVersion != \"\") && csharp10orLater == \"true\"" } }, "primaryOutputs": [ @@ -89,24 +102,19 @@ ], "sources": [ { - "exclude": [ "**/[Bb]in/**", "**/[Oo]bj/**", ".template.config/**/*", "**/*.filelist", "**/*.lock.json" ], - "modifiers": [ - { - "condition": "(UseWindowsDesktopSdk)", - "exclude": [ - "Company.ControlLibrary1.csproj" - ], - "rename": { - "Company.ControlLibrary3x1.csproj": "Company.ControlLibrary1.csproj" - } - }, - { - "condition": "(!UseWindowsDesktopSdk)", - "exclude": [ - "Company.ControlLibrary3x1.csproj" - ] - } - ] + "condition": "Framework == \"netcoreapp3.1\"", + "source": "./netcoreapp3.1", + "target": "./" + }, + { + "condition": "Framework == \"net5.0\"", + "source": "./net5.0", + "target": "./" + }, + { + "condition": "Framework == \"net6.0\"", + "source": "./net6.0", + "target": "./" } ], "defaultName": "WinFormsControlLibrary1", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/Company.ControlLibrary1.csproj b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/net5.0/Company.ControlLibrary1.csproj similarity index 100% rename from pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/Company.ControlLibrary1.csproj rename to pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/net5.0/Company.ControlLibrary1.csproj diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/Company.ControlLibrary1.csproj.user b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/net5.0/Company.ControlLibrary1.csproj.user similarity index 100% rename from pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/Company.ControlLibrary1.csproj.user rename to pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/net5.0/Company.ControlLibrary1.csproj.user diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/UserControl1.Designer.cs b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/net5.0/UserControl1.Designer.cs similarity index 100% rename from pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/UserControl1.Designer.cs rename to pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/net5.0/UserControl1.Designer.cs diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/UserControl1.cs b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/net5.0/UserControl1.cs similarity index 100% rename from pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/UserControl1.cs rename to pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/net5.0/UserControl1.cs diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/net6.0/Company.ControlLibrary1.csproj b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/net6.0/Company.ControlLibrary1.csproj new file mode 100644 index 00000000000..a689b368cb8 --- /dev/null +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/net6.0/Company.ControlLibrary1.csproj @@ -0,0 +1,13 @@ + + + + FrameworkParameter-windows + TargetFrameworkOverride-windows + Company.ControlLibrary1 + $(ProjectLanguageVersion) + enable + true + enable + + + diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/net6.0/Company.ControlLibrary1.csproj.user b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/net6.0/Company.ControlLibrary1.csproj.user new file mode 100644 index 00000000000..81dca9d6b83 --- /dev/null +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/net6.0/Company.ControlLibrary1.csproj.user @@ -0,0 +1,8 @@ + + + + + UserControl + + + \ No newline at end of file diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/net6.0/UserControl1.Designer.cs b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/net6.0/UserControl1.Designer.cs new file mode 100644 index 00000000000..fdafbb7f89e --- /dev/null +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/net6.0/UserControl1.Designer.cs @@ -0,0 +1,78 @@ +#if (csharpFeature_FileScopedNamespaces) +namespace Company.ControlLibrary1; + +partial class UserControl1 +{ + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + } + + #endregion +} +#else +namespace Company.ControlLibrary1 +{ + partial class UserControl1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + } + + #endregion + } +} +#endif diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/net6.0/UserControl1.cs b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/net6.0/UserControl1.cs new file mode 100644 index 00000000000..bcea26122e3 --- /dev/null +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/net6.0/UserControl1.cs @@ -0,0 +1,27 @@ +#if (!csharpFeature_ImplicitUsings) +using System; +using System.Windows.Forms; + +#endif +#if (csharpFeature_FileScopedNamespaces) +namespace Company.ControlLibrary1; + +public partial class UserControl1: UserControl +{ + public UserControl1() + { + InitializeComponent(); + } +} +#else +namespace Company.ControlLibrary1 +{ + public partial class UserControl1: UserControl + { + public UserControl1() + { + InitializeComponent(); + } + } +} +#endif diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/Company.ControlLibrary3x1.csproj b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/netcoreapp3.1/Company.ControlLibrary1.csproj similarity index 100% rename from pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/Company.ControlLibrary3x1.csproj rename to pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/netcoreapp3.1/Company.ControlLibrary1.csproj diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/netcoreapp3.1/Company.ControlLibrary1.csproj.user b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/netcoreapp3.1/Company.ControlLibrary1.csproj.user new file mode 100644 index 00000000000..81dca9d6b83 --- /dev/null +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/netcoreapp3.1/Company.ControlLibrary1.csproj.user @@ -0,0 +1,8 @@ + + + + + UserControl + + + \ No newline at end of file diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/netcoreapp3.1/UserControl1.Designer.cs b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/netcoreapp3.1/UserControl1.Designer.cs new file mode 100644 index 00000000000..204ef56e8ff --- /dev/null +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/netcoreapp3.1/UserControl1.Designer.cs @@ -0,0 +1,38 @@ +namespace Company.ControlLibrary1 +{ + partial class UserControl1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + } + + #endregion + } +} diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/netcoreapp3.1/UserControl1.cs b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/netcoreapp3.1/UserControl1.cs new file mode 100644 index 00000000000..4bb7a869b7c --- /dev/null +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsControlLibrary-CSharp/netcoreapp3.1/UserControl1.cs @@ -0,0 +1,13 @@ +using System; +using System.Windows.Forms; + +namespace Company.ControlLibrary1 +{ + public partial class UserControl1: UserControl + { + public UserControl1() + { + InitializeComponent(); + } + } +} diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/template.json b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/template.json index 642cc550a0d..3ed92a48c70 100644 --- a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/template.json +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/.template.config/template.json @@ -49,10 +49,6 @@ "defaultValue": "net6.0", "displayName": "Framework" }, - "UseWindowsDesktopSdk": { - "type": "computed", - "value": "(Framework == \"netcoreapp3.1\")" - }, "langVersion": { "type": "parameter", "datatype": "text", @@ -78,6 +74,23 @@ "defaultValue": "true", "description": "Whether to enable nullable reference types for this project.", "displayName": "Enable nullable" + }, + "csharp10orLater": { + "type": "generated", + "generator": "regexMatch", + "datatype": "bool", + "parameters": { + "pattern": "^(|10\\.0|10|preview|latest|default|latestMajor)$", + "source": "langVersion" + } + }, + "csharpFeature_ImplicitUsings": { + "type": "computed", + "value": "Framework == \"net6.0\" && csharp10orLater == \"true\"" + }, + "csharpFeature_FileScopedNamespaces": { + "type": "computed", + "value": "(Framework == \"net6.0\" || langVersion != \"\") && csharp10orLater == \"true\"" } }, "primaryOutputs": [ @@ -89,23 +102,19 @@ ], "sources": [ { - "modifiers": [ - { - "condition": "(UseWindowsDesktopSdk)", - "exclude": [ - "Company.ClassLibrary1.csproj" - ], - "rename": { - "Company.ClassLibrary3x1.csproj": "Company.ClassLibrary1.csproj" - } - }, - { - "condition": "(!UseWindowsDesktopSdk)", - "exclude": [ - "Company.ClassLibrary3x1.csproj" - ] - } - ] + "condition": "Framework == \"netcoreapp3.1\"", + "source": "./netcoreapp3.1", + "target": "./" + }, + { + "condition": "Framework == \"net5.0\"", + "source": "./net5.0", + "target": "./" + }, + { + "condition": "Framework == \"net6.0\"", + "source": "./net6.0", + "target": "./" } ], "defaultName": "WinFormsLibrary1", diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/Class1.cs b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/net5.0/Class1.cs similarity index 100% rename from pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/Class1.cs rename to pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/net5.0/Class1.cs diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/Company.ClassLibrary1.csproj b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/net5.0/Company.ClassLibrary1.csproj similarity index 100% rename from pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/Company.ClassLibrary1.csproj rename to pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/net5.0/Company.ClassLibrary1.csproj diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/net6.0/Class1.cs b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/net6.0/Class1.cs new file mode 100644 index 00000000000..ceddf45fb29 --- /dev/null +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/net6.0/Class1.cs @@ -0,0 +1,18 @@ +#if (!csharpFeature_ImplicitUsings) +using System; + +#endif +#if (csharpFeature_FileScopedNamespaces) +namespace Company.ClassLibrary1; + +public class Class1 +{ +} +#else +namespace Company.ClassLibrary1 +{ + public class Class1 + { + } +} +#endif diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/net6.0/Company.ClassLibrary1.csproj b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/net6.0/Company.ClassLibrary1.csproj new file mode 100644 index 00000000000..62f2f26fda0 --- /dev/null +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/net6.0/Company.ClassLibrary1.csproj @@ -0,0 +1,13 @@ + + + + FrameworkParameter-windows + TargetFrameworkOverride-windows + Company.ClassLibrary1 + $(ProjectLanguageVersion) + enable + true + enable + + + diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/netcoreapp3.1/Class1.cs b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/netcoreapp3.1/Class1.cs new file mode 100644 index 00000000000..72abb3efe5a --- /dev/null +++ b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/netcoreapp3.1/Class1.cs @@ -0,0 +1,8 @@ +using System; + +namespace Company.ClassLibrary1 +{ + public class Class1 + { + } +} diff --git a/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/Company.ClassLibrary3x1.csproj b/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/netcoreapp3.1/Company.ClassLibrary1.csproj similarity index 100% rename from pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/Company.ClassLibrary3x1.csproj rename to pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsLibrary-CSharp/netcoreapp3.1/Company.ClassLibrary1.csproj