Winforms 如何在没有visual studio的情况下创建f#windows应用程序(无cmd窗口)

Winforms 如何在没有visual studio的情况下创建f#windows应用程序(无cmd窗口),winforms,visual-studio,f#,text-editor,visual-studio-project,Winforms,Visual Studio,F#,Text Editor,Visual Studio Project,如果不使用Visual Studio,是否可以在F#中创建Winforms应用程序,其中不会打开任何CMD窗口 我知道我可以简单地创建一个VS项目,并将“输出类型”设置为“Windows应用程序”。但我真的很喜欢这种简单地启动任何类型的文本编辑器并开始黑客攻击的方法 打开任何编辑器并编写如下内容: open System open System.Drawing open System.Windows.Forms // Create form, button and add button to

如果不使用Visual Studio,是否可以在F#中创建Winforms应用程序,其中不会打开任何CMD窗口


我知道我可以简单地创建一个VS项目,并将“输出类型”设置为“Windows应用程序”。但我真的很喜欢这种简单地启动任何类型的文本编辑器并开始黑客攻击的方法

打开任何编辑器并编写如下内容:

open System
open System.Drawing
open System.Windows.Forms

// Create form, button and add button to form
let form = new Form(Text = "Hello world!")
let btn = new Button(Text = "Click here")
form.Controls.Add(btn)

// Register event handler for button click event
btn.Click.Add(fun _ ->
  // Generate random color and set it as background
  let rnd = new Random()
  let r, g, b = rnd.Next(256), rnd.Next(256), rnd.Next(256)
  form.BackColor <- Color.FromArgb(r, g, b) )

// Show the form (in F# Interactive)
form.Show()
// Run the application (in compiled application)
Application.Run(form)
开放系统
开放系统.绘图
打开System.Windows.Forms
//创建表单、按钮和向表单添加按钮
let form=新表单(Text=“Hello world!”)
让btn=新建按钮(Text=“单击此处”)
表单.控件.添加(btn)
//为按钮单击事件注册事件处理程序
btn.点击.添加(乐趣->
//生成随机颜色并将其设置为背景
设rnd=new Random()
设r,g,b=rnd.Next(256),rnd.Next(256),rnd.Next(256)
form.BackColor只需在编译器选项中使用--target:WinExe即可

fsc source.fsx--target:WinExe

最简单的方法是按照linux的一些说明,只想知道如何更改指向fsharpc.exe的路径谢谢你的回答。也许我的问题有些含糊。我的意图是在哪里创建exe文件。@sam的答案正是我想要的。