how do I simulate, from the command line, compiling an F# file with fsc.exe:
?
So far it seems that I need to make a project at all costs, but that is simply not an option in my scenario.
Assuming by simulate you mean, how do I build F# files with fsc.exe, you can just pass through files in the order that they are referenced to fsc.exe.
If you had the following files
Message.fs
module Message
let customMessage = "Hello, from message"
and Hello.fs
module Hello
open System
open Message
let main args =
printfn "%s" customMessage
0
You compile those with (something like):
'C:\\Program Files (x86)\\Microsoft SDKs\\F#\\3.1\\Framework\\v4.0\\Fsc.exe' C:\\dev\\Message.fs C:\\dev\\Hello.fs
Edit
In order to compile this referencing a specific version, you need to update your references as per @nicolas response.
You need to specify --noframework
and provide FSharp.Core and mscorlib.
I was able to do this using the FSharp reference assemblies. For whatever reason, I needed to be in that directory (eg C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\FSharp
)
I could then run this:
'C:\Program Files (x86)\Microsoft SDKs\F#\3.1\Framework\v4.0\Fsc.exe' --out:c:\dev\Hello.exe --noframework -r:C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorlib.dll -r:"2.0\Runtime\v2.0\FSharp.Core.dll" C:\dev\Message.fs C:\dev\Hello.fs
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.