I find some good post on F#/WPF programming, but it doesn’t seem to teach a way to compile/build the code to make binary out of F#/WPF.
What command/tool do I use to build/compile this code into execution binary? Just running fsc or fsi doesn’t seem to work.
#light
#I @"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0"
#r @"WindowsBase.dll"
#r @"PresentationCore.dll"
#r @"PresentationFramework.dll"
open System
open System.Windows
(* From Chap 1 - SayHello.cs *)
let win = new Window()
win.Title <- "Say Hello"
win.Show()
#if COMPILED
[<STAThread()>]
do
let app = new Application() in
app.Run() |> ignore
#endif
If you want to compile the code using
fscthen you’ll need to remove the#Iand#rcommands and use a compiler command line arguments instead. The#lightcommand is not required anymore, so you can just delete first 5 lines. In addition to the#rreferences, I also had to addSystem.Xaml.dll(which is probably new in .NET 4)Then you can compile it using something like:
Running the code in
fsi.exeshould work just fine (after adding#r "System.Xaml.dll"). Just copy the code and paste it to the F# Interactive (running either in console or in Visual Studio IDE).