Add Warning in WindowsDesktop SDK for UseWinForms
See original GitHub issueSee 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
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:10 (9 by maintainers)

Top Related StackOverflow Question
/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 😉@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 checkUseWindowsFormsin targets and notUseWinFormswhich 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?