简体   繁体   English

如何在Mac上使用从nuget下载的软件包(Mono)

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

I tried to use nuget for downloading packages. 我试着用nuget下载包。 For example, I'm trying to use suave.io for web programming with F# on Mac. 例如,我正在尝试使用suave.io在Mac上使用F#进行Web编程。

With nuget (aliased as 'mono /bin/mono/nuget.exe'), I could download the packages. 使用nuget(别名为'mono /bin/mono/nuget.exe'),我可以下载软件包。

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. 问题是,与在/ usr / local / Cellar中安装软件包的brew相比,它下载了当前目录中的软件包(库)。

What's the next step to use the downloaded library with Mono? 将下载的库与Mono一起使用的下一步是什么? Even better, is there a way to use the download and install the libraries from my F#/C# code easily? 更好的是,有没有办法轻松使用下载并从我的F#/ C#代码安装库?

From the comments of the question, I could make the suave webserver working. 从问题的评论中,我可以使suave webserver工作。

I copied the downloaded packages to the place where I collect nuget packages ( /bin/mono/ ). 我将下载的软件包复制到我收集nuget软件包的地方( /bin/mono/ )。 Then, I made F# script (hello.fsx). 然后,我制作了F#脚本(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. 使用fsharpi hello.fsx运行代码使Web服务器正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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