Reputation: 29159
I created a .Net core 2.1 F# console application in Visual Studio 2017 on Windows. I would try the code in F# Interactive window. However, right-clicking the Dependencies
will not show the command of sending the reference to F# Interactive window. Expanding the NuGet tree can find the DLL file names but they don't have the full path so I cannot manually run #r ".../full path/Akka.FSharp.dll";;
.
The code of the testing .Net core application.
open System
open Akka.FSharp
let system = System.create "MovieStreamingActorSystem" <| Configuration.load ()
type ProcessorMessage = ProcessJob of int * int * string
let processor (mailbox: Actor<ProcessorMessage>) =
let rec loop () = actor {
let! m = mailbox.Receive ()
printfn "Message %A" m
return! loop ()
}
loop ()
[<EntryPoint>]
let main argv =
let processorRef = spawn system "processor" processor
processorRef <! ProcessJob(1, 2, "3")
0
Upvotes: 5
Views: 946
Reputation: 6324
You cannot do this at this time as F# Interactive doesn't support .net core. 🙃 However as the API surface is almost identical to .net 4.7 and you can nuget necessary packages just reference it directly, just get whatever dlls are necessary directly and use #r
:
#if INTERACTIVE
#r "System.IO.Compression.FileSystem.dll"
#endif
For example this will let you use some extension methods for zip archives by pulling in the compression dll from .net.
The .net core dlls will be packaged up in the publish
folder, if you decide to create a framework independent pacakage. Whatever full framework dlls you would need for fsharp interactive just pull them down directly or to another project.
By the way, if you wonder where the .net core nuget packages get pulled down, it's in:
C:\Users\$USERNAME\.nuget\packages
. You should find net45 and netstandard2 versions when supported.
Update: In VS2019 preview F# Interactive is dotnetcore, and it's possible to reference dotnetstandard dlls.
Upvotes: 4