According to other answers, I try to add project reference. I open the reference manager to find System.Windows.Forms and add it, but the project reference shows "No items found". So how can I add the reference? enter image description here
enter image description here
As Jimi's comment suggests, you cannot directly reference System.Windows.Forms.dll because it's part of the runtime. Instead, add the following to your project file: <UseWindowsForms>true</UseWindowsForms> and make sure the target framework is set as <TargetFramework>net6.0-windows</TargetFramework> (and not only net6.0), because Windows Forms is only supported on Windows.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With