Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

F# VS2019 Windows Forms

I'm learning F# and I'm just trying to build Animate a pendulum program. Here's the code: https://rosettacode.org/wiki/Animate_a_pendulum#F.23

As far as I understand, VS 2019 doesn't support WinForms in F# (maybe, I'm wrong), so I have error messages, trying to copy/paste that code:

enter image description here

What should I do?
Thanks a lot !

like image 685
FullyFunctional Avatar asked Mar 19 '26 23:03

FullyFunctional


1 Answers

If you're looking to use Winforms on .NET core, you'll need to do the following in your project:

  1. Open the project file (double-click on the node in Visual Studio)
  2. Change the Sdk to Microsoft.NET.Sdk.WindowsDesktop
  3. Ensure you have this OutputType: <OutputType>WinExe</OutputType>
  4. Add the following property to the top-level PropertyGroup: <UseWindowsForms>true</UseWindowsForms>

There won't be a visual designer to use, but you should have access to the APIs.

like image 183
Phillip Carter Avatar answered Mar 23 '26 03:03

Phillip Carter



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!