简体   繁体   中英

How to use packages download from nuget on Mac (Mono)

I tried to use nuget for downloading packages. For example, I'm trying to use suave.io for web programming with F# on Mac.

With nuget (aliased as 'mono /bin/mono/nuget.exe'), I could download the packages.

nuget install Suave 
Attempting to resolve dependency 'FSharp.Core (≥ 3.1.2.1)'.
Attempting to resolve dependency 'FsPickler (≥ 1.0.7)'.
Installing 'FSharp.Core 3.1.2.1'.
Successfully installed 'FSharp.Core 3.1.2.1'.
Installing 'FsPickler 1.0.7'.
Successfully installed 'FsPickler 1.0.7'.
Installing 'Suave 0.24.0'.
Successfully installed 'Suave 0.24.0'.

The issue is that compared to brew that installs the package in /usr/local/Cellar, it downloads the package (library) in current directory.

What's the next step to use the downloaded library with Mono? Even better, is there a way to use the download and install the libraries from my F#/C# code easily?

From the comments of the question, I could make the suave webserver working.

I copied the downloaded packages to the place where I collect nuget packages ( /bin/mono/ ). Then, I made F# script (hello.fsx).

#r @"/bin/mono/Suave.0.24.0/lib/net40/Suave.dll"

open Suave                 // always open suave
open Suave.Http.Successful // for OK-result
open Suave.Web             // for config

web_server default_config (OK "Hello World!")

Running the code with fsharpi hello.fsx makes the web server working.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM