question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add Warning in WindowsDesktop SDK for UseWinForms

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
vatsan-madhavancommented, Jun 26, 2019

/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 😉

1reaction
davkeancommented, Jun 26, 2019

@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?

Read more comments on GitHub >

github_iconTop Results From Across the Web

MSBuild reference for .NET Desktop SDK projects
Reference for the MSBuild properties and items that are understood by the .NET Desktop SDK, which includes WPF and WinForms.
Read more >
NETSDK1137: Don't use the Microsoft.NET.Sdk. ...
In this article ... NETSDK1137 indicates that your project specifies an outdated project SDK. The full error message is similar to the following ......
Read more >
Upgrading Windows Desktop Applications with .NET Core 3
NET Core 3.0 SDK comes with a tool that can analyze intermediate language (IL) and trim unused assemblies, which may reduce the size...
Read more >
How can I eliminate warning NETSDK1137 in a .NET 5 ...
NET 5. Warning NETSDK1137 It is no longer necessary to use the Microsoft.NET.Sdk.WindowsDesktop SDK. Consider changing the Sdk attribute of ...
Read more >
Intro to Windows Forms (WinForms) in .NET 6
So, when would we use WinForms? In this video, I am going to show you what WinForms is, how to build it, what...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found