-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
area-TemplatesenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additionspriority-1Work that is critical for the release, but we could probably ship withoutWork that is critical for the release, but we could probably ship without
Description
We can simplify our templates with global usings and have them implemented similar to this:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework Condition="'$(TargetFrameworkOverride)' == ''">FrameworkParameter-windows</TargetFramework>
<TargetFramework Condition="'$(TargetFrameworkOverride)' != ''">TargetFrameworkOverride-windows</TargetFramework>
<RootNamespace Condition="'$(name)' != '$(name{-VALUE-FORMS-}safe_namespace)'">Company.WinFormsApplication1</RootNamespace>
<LangVersion Condition="'$(langVersion)' != ''">$(ProjectLanguageVersion)</LangVersion>
<Nullable Condition="'$(Nullable)' == 'true'">enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
+ <ItemGroup>
+ <Compile Include=".usings" />
+ </ItemGroup>
</Project>A sample .using file:
global using System;
global using System.Collections.Generic;
global using System.Drawing;
global using System.Linq;
global using System.Threading.Tasks;
global using System.Windows.Forms;This list of usings looks sensible, but it is up for a discussion.
Credits for this idea go to https://github.com/khalidabuhakmeh/CsharpTenFeatures.
At some point in the future when dotnet/aspnetcore#32451 settles, we could follow in their steps and bake all typical Windows Forms usings into the Windows Desktop SDK.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-TemplatesenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additionspriority-1Work that is critical for the release, but we could probably ship withoutWork that is critical for the release, but we could probably ship without