Open davkean opened 5 years ago
There are also imports in the WPF template.
And the implicit imports for Visual Basic Console App is in the Microsoft.NET.Sdk.VisualBasic.targets.
I don't think it'll be a small change to move the imports to SDK.
@KlausLoeffelmann do you have thoughts on this one?
@KathleenDollard, this is also something we need to talk about.
We'll further discuss this when we'll add the HighDpiSetting to Project System.
Whats there to discuss? As far as I can tell these imports are already implicitly added, I just removed them from the project file and everything still compiles even if types from these assemblies are used. I don't think this is language-specific, C# projects don't add these imports either, so looking in the language-specific targets is probably the wrong place to look.
(Note that if you remove the imports then Application.Designer.HighDpi.vb
fails to compile because its missing an Imports System.Windows.Forms
statement and not qualifying HighDpiMode
fully. IMHO its bad practice to not specify the namespace imports your designer code relys on, since you never know what the user has in the project file anyways)
[edit] nevermind I mixed up <Reference>
and <Import>
declarations. These are adding default-imports which only exists in VB and not in C#. In that case I agree this depends on the project system and probably needs further discussion how to handle.
I'd still argue the Designer file should be written to be independent of any (possibly absent) default imports.
@weltkante: I want to get rid of Application.Designer.HeighDpi.vb
altogether for the .NET 6 templates. The remark was more of a reminder to all of us that we need to address a few issues around this come the new year. In this context: Thanks so much again for all your support, erholsame Feiertage und nen guten Rutsch ins neue Jahr!
@KlausLoeffelmann is this something we still plan to do? I've moved to .NET 9 for now.
Yes.
Moving to .NET 10.
dotnet --info
)Problem description:
Unlike the VB Console App and WPF App, the Windows Forms template has some (but not all) "explicit" imports. These should be moved to the Windows Desktop SDK similar to the rest of the imports to keep the project file small by default.