F#/WPF代码的编译
我在F#/WPF编程中发现了一些问题,但它似乎没有教我们如何编译/构建代码,使F#/WPF变成二进制 我使用什么命令/工具将代码编译成执行二进制代码?仅仅运行F#/WPF代码的编译,wpf,f#,Wpf,F#,我在F#/WPF编程中发现了一些问题,但它似乎没有教我们如何编译/构建代码,使F#/WPF变成二进制 我使用什么命令/工具将代码编译成执行二进制代码?仅仅运行fsc或fsi似乎不起作用 #light #I @"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0" #r @"WindowsBase.dll" #r @"PresentationCore.dll" #r @"PresentationFramework.dll"
fsc
或fsi
似乎不起作用
#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
#灯
#I@“C:\Program Files\Reference Assembly\Microsoft\Framework\v3.0”
#r@“WindowsBase.dll”
#r@“PresentationCore.dll”
#r@“PresentationFramework.dll”
开放系统
开放系统
(*来自第1章-SayHello.cs*)
let win=新窗口()
获胜。标题忽略
#恩迪夫
运行fsc应该可以工作。您需要将--target:winexe命令行参数传递给fsc.exe
有关更多信息,请参阅。运行fsc应该可以工作。您需要将--target:winexe命令行参数传递给fsc.exe
有关更多信息,请参阅。如果要使用fsc
编译代码,则需要删除#I
和#r
命令,并改用编译器命令行参数。不再需要#light
命令,因此您只需删除前5行即可。除了#r
引用之外,我还必须添加System.Xaml.dll
(这在.NET4中可能是新的)
然后您可以使用以下方法编译它:
fsc.exe -r:WindowsBase.dll -r:PresentationCore.dll -r:System.Xaml.dll
-r:PresentationFramework.dll --target:winexe Main.fs
在fsi.exe
中运行代码应该可以正常工作(在添加#r“System.Xaml.dll”
之后)。只需复制代码并将其粘贴到F#Interactive(在控制台或Visual Studio IDE中运行)。如果要使用fsc
编译代码,则需要删除#I
和#r
命令,并使用编译器命令行参数。不再需要#light
命令,因此您只需删除前5行即可。除了#r
引用之外,我还必须添加System.Xaml.dll
(这在.NET4中可能是新的)
然后您可以使用以下方法编译它:
fsc.exe -r:WindowsBase.dll -r:PresentationCore.dll -r:System.Xaml.dll
-r:PresentationFramework.dll --target:winexe Main.fs
在fsi.exe
中运行代码应该可以正常工作(在添加#r“System.Xaml.dll”
之后)。只需复制代码并将其粘贴到F#Interactive(在控制台或Visual Studio IDE中运行)