Tomas Jansson
Tomas Jansson

Reputation: 23462

Unable to find akka.dll in mono using F#

I wanted to try out the akka.net F# API on OSX with mono. Since I'm just playing around I thought I would add a simple script file to get started, but it fails when I try to create the actor system. A simple .fsx to reproduce the error:

#r "./packages/Akka/lib/net45/Akka.dll"
#r "./packages/FsPickler/lib/net45/FsPickler.dll"
#r "./packages/FSPowerPack.Linq.Community/lib/net40/FSharp.PowerPack.Linq.dll"
#r "./packages/Akka.FSharp/lib/net45/Akka.FSharp.dll"

open Akka.FSharp

let system = System.create "my-system" (Configuration.load())

The error message is clear I think:

Users/tomasjansson/git/suave_akka_react/stdin(0,1): error FS0078: Unable to find the file 'Akka.dll' in any of /Library/Frameworks/Mono.framework/Versions/4.2.1/lib/mono/4.5 /Users/tomasjansson/git/suave_akka_react /Library/Frameworks/Mono.framework/Versions/4.2.1/lib/mono/4.5/

/Users/tomasjansson/git/suave_akka_react/stdin(0,1): error FS0078: Unable to find the file 'Akka.dll' in any of /Library/Frameworks/Mono.framework/Versions/4.2.1/lib/mono/4.5 /Users/tomasjansson/git/suave_akka_react /Library/Frameworks/Mono.framework/Versions/4.2.1/lib/mono/4.5/ Could not load signature of Akka.FSharp.System:create due to: Could not load file or assembly or one of its dependencies. assembly:Akka, Version=1.0.5.15, Culture=neutral, PublicKeyToken=null type:

I cant find Akka.dll, but I do reference it at the beginning of the file. What is going on?

Upvotes: 1

Views: 384

Answers (2)

Simon Dickson
Simon Dickson

Reputation: 711

Try adding this to the top of the file #I "./packages/Akka/lib/net45".

Not sure why, it could have been compiled to expect a local copy or something like that.

Upvotes: 1

Naveen
Naveen

Reputation: 4110

Here is the code. I was able to get it working on mono on OSX. I used the paket to download the dependencies within the script. In the interactive session the script path has to be referenced.

open System
open System.IO

Environment.CurrentDirectory <- __SOURCE_DIRECTORY__

if not (File.Exists "paket.exe") then
    let url = "http://fsprojects.github.io/Paket/stable"
    use wc = new Net.WebClient() in let tmp = Path.GetTempFileName() in let stable = wc.DownloadString(url) in wc.DownloadFile(stable, tmp); File.Move(tmp,Path.GetFileName stable)

#r "paket.exe"

Paket.Dependencies.Install """
    source https://nuget.org/api/v2
    nuget Akka
    nuget FsPickler
    nuget FSPowerPack.Core.Community
    nuget FSPowerPack.Linq.Community
    nuget Akka.FSharp
""";;

#I "./packages/Akka/lib/net45"
#I "./packages/Akka.FSharp/lib/net45"
#I "./packages/FsPickler/lib/net45"
#I "./packages/FSPowerPack.Core.Community/Lib/net40"
#I "./packages/FSPowerPack.Linq.Community/Lib/net40"
#I "./packages/Newtonsoft.Json/lib/net45"


#r "Akka.dll"
#r "FsPickler.dll"
#r "FSharp.PowerPack.Linq.dll"
#r "Akka.FSharp.dll"

open Akka.FSharp

let system = System.create "my-system" (Configuration.load())

Upvotes: 4

Related Questions