Unable to use Windows Forms in F# Interactive with dotnet core #5867
-
F# interactive is a REPL for interactive programming. It has been around since about 2010 when F# was introduced. We were able to use Windows Forms in an interactive mode ever since. However, with dotnet core, the way Windows Forms is packaged, it is not possible to do that any more. Previously, the way to reference the library and create forms in F# interactive was: #r "System.Windows.Forms.dll"
let f = new System.Windows.Forms.Form()
f.Text <- "Title"
[... add controls and callbacks ...]
f.Show()
Windows Forms still works in compiled F# projects - just not in interactive mode. This is a big loss for people like me who work in data science where much of the initial work is done interactively. As an example, we could visualize graph or network data interactively using the MSAGL viewer. Another good use of Forms (using the DataGridView control) was to preview Microsoft ML IDataView datasets. I have often used Forms for custom visualizations as well. I believe the use of interactive programming will increase not decrease over time. I would greatly appreciate if we get back the ability to use Windows Forms in F# interactive. Note that with newer versions of F# interactive, nuget packages can be referenced as: #r "nuget: <package ref>" If the Windows Forms and related functionality can be packaged as nuget package then that would solve the problem. Faisal |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
.NET no longer ships Windows Forms or WPF as standalone workloads, those have been bundled together and are shipped as Windows Desktop workload. |
Beta Was this translation helpful? Give feedback.
-
@fwaris : vscode with the dotnet interactive notebooks addon does F# and rich output pretty nicely. Please check it out and let us know what you think. We do hope to have a better story for fsi and frameworks like wpf and winforms, but priorities haven't allowed us to collect our thoughts on it yet. Here is a link to notebooks with vscode: https://github.com/dotnet/interactive#notebooks-with-net I hope this helps Kevin |
Beta Was this translation helpful? Give feedback.
@fwaris :
this is not yet a supported F# scenario. We have not yet done the analysis for how to support these type of scenarios directly in F# interactive. We have been focussed on making dotnet interactive notebooks support F# well.
vscode with the dotnet interactive notebooks addon does F# and rich output pretty nicely.
Please check it out and let us know what you think. We do hope to have a better story for fsi and frameworks like wpf and winforms, but priorities haven't allowed us to collect our thoughts on it yet.
Here is a link to notebooks with vscode: https://github.com/dotnet/interactive#notebooks-with-net
I hope this helps
Kevin