See https://github.com/dotnet/wpf/pull/1027#issuecomment-505092719
The comment from @drewnoakes suggests that there is occasional confusion that leads to the use of UseWinForms in Microsoft.NET.Sdk.WindowsDesktop based projects instead of using the correct property UseWindowsForms.
The current behavior will be warning NETSDK1106 ("Windows Desktop SDK requires UseWpf or UseWindowsForms"). This should help the vast majority of WinForms projects that guess the property name wrong.
The small number of projects that try to set UseWpf and UseWinForms (instead of the correct property UseWindowsForms) will not receive any warnings today.
We should evaluate whether a new warning is needed to help those who set UseWinForms and add it to the WindowsDesktop SDK.
/cc @merriemcgaw, @OliaG
/cc @RussKie, @davkean, @dsplaisted, @drewnoakes , @stevenbrix , @rladuca , @ryalanms , @nguerrera @davidwengier
This is my attempt at gently moving over the discussion about WindowsForms vs. WinForms from https://github.com/dotnet/wpf/pull/1027 over to here. I think I've tagged everyone who was a participant there except bot-accounts ;-)
https://github.com/dotnet/wpf/pull/1027#issuecomment-505717076
Accepting both definitions I think would be a mistake, as there are already downstream consumers of this (our capabilities are already driven off this)
@davkean, why would accepting both definitions be a problem? Couldn't we make it so whenever UseWinForms is set, UseWindowsForms is also set by WindowsDesktop SDK targets, so that the rest of our tooling can continue working off of UseWindowsForms without having to be aware of this accommodation ?
https://github.com/dotnet/wpf/pull/1027#issuecomment-505715041
Regardless of what's used, I maintain customers who hand edit their project file and use the incorrect version will appreciate guidance that they're not quite doing what's needed. Currently there's no feedback. This is not the pit of success.
@drewnoakes, not quite - please refer to the issue description above.
These fail to receive warnings/guidance today:
Microsoft.NET.Sdk.WindowsDesktop projects that set UseWpf and also set UseWinFormsMicrosoft.NET.Sdk projects that set UseWinForms These will receive warnings today:
Microsoft.NET.Sdk.WindowsDesktop projects that set only UseWinFormsMicrosoft.NET.Sdk.WindowsDesktop projects that fail to set at least one of UseWindowsForms, UseWpfMicrosoft.NET.Sdk projects that set one or both of UseWindowsForms, UseWpf@vatsan-madhavan The assumption there is that SDK targets files are evaluated _before_ anything else that consumes UseWindowsForms, which might not always be the case. The other assumption that is folks are going to know that they need to check UseWindowsForms in targets and not UseWinForms which is not the canonical value. I'm convinced that having multiple ways to represent the same thing, will result in the reverse confusion "which one do we set and which one do I use in conditions and targets?"
If we were to do something about this, I think a warning or error would be enough, they'll immediately see the mistake and fix it. Do we have any existing confusion already on this during the previews @dsplaisted @nguerrera that would lead towards this?
This was the first I heard of it, but for a long time we hadn't done the work to give you different references and there are no build target changes for winforms over wpf. So it's possible that some impacted projects didn't notice.
I agree with not having more than one valid spelling. A warning would be better.
I think a warning should be sufficient, though the team really thinks that an alias would be nice - because all of our docs/repos/etc use "winforms". We could argue that "winforms" was the more correct one to use. It seems like aliasing would be the least disruptive change. Though we'd argue that we should change to winforms.
/cc @OliaG
Unlike WPF docs which do use "WPF", the Windows Forms docs uses "Windows Forms" with exception to the URL: https://docs.microsoft.com/en-us/dotnet/framework/winforms/.
There's no concept of aliasing in MSBuild, you would need to assign one to the other which leads to "which one do I use for conditions and how do I know this?".
I spoke with @zsd4yr and @OliaG and we're going to have to leave it as is. We can't get an alias and we don't want to force folks to say dotnet new windowsforms.
We can't get an alias and we don't want to force folks to say
dotnet new winforms.
dotnet new winforms already works today. I don't think anyone is proposing that we change this to dotnet new windowsforms etc.
The small number of projects that try to set
UseWpfandUseWinForms(instead of the correct property UseWindowsForms) will not receive any warnings today.
We should evaluate whether a new warning is needed to help those who set UseWinForms and add it to the WindowsDesktop SDK.
We should address the lack of warnings for users in this situation. I'm afraid that we've closed the issue without addressing this.
It's ok if WinForms decides that we won't show warnings to users who are especially interested in WPF/WinForms interop and happen to get one of the property names wrong.
That said, if we do want to add a warning for this category erroneous usages, it seems to me that it would be feasible to add such a warning easily.
Sorry - there was a typo in my comment (I should have realized that's what you were talking about). I edited. We had considered that to enable the consistent use of a term. We discarded that thought pretty quickly :)
Most helpful comment
/cc @RussKie, @davkean, @dsplaisted, @drewnoakes , @stevenbrix , @rladuca , @ryalanms , @nguerrera @davidwengier
This is my attempt at gently moving over the discussion about
WindowsFormsvs.WinFormsfrom https://github.com/dotnet/wpf/pull/1027 over to here. I think I've tagged everyone who was a participant there except bot-accounts ;-)