It's my first hours with F#, playing with it on Ubuntu Linux (14.04) but I am lost how to include install dependencies with nuget. I have nuget.exe
working fine on Mono and i can nuget install
packages; they land in my current directory. But then i can't import or open them from my example.fs
file. I tried various options but to no avail. Do i need to write a project file or use FAKE? I couldn't find any tutorial which details the minimal necessary steps to setup a simple project.
So what do i need to do to access dependencies i installed with nuget?
The short answer is that it is not completely straightforward. The long answer is that you can approach the problem in a few different ways. All the methods I will suggest here use the MSBuild .fsproj projects, so that you can build with xbuild MyProject.fsproj
. It's worth noting that FAKE scripts tend to use fsproj projects as well, and hand off to xbuild for the actual compilation. The fsharp.org website has some instructions on bootstrapping NuGet configuration and is a great resource in general.
Use MonoDevelop. I recommend building from source. Get a tag from https://github.com/mono/monodevelop, and follow the instructions carefully. Then install the Nuget plugin. Create an F# project and use the interface in MonoDevelop to add NuGet packages to your project. You can then build from the command line or from MonoDevelop.
Find an existing project that uses NuGet, gut it, and use the editor of your choice. A heavyweight example is https://github.com/fsprojects/ProjectScaffold, you can find others around there. Once you have this project downloaded you will be able to see how to edit the nuget.config
file to adjust your dependencies.
A recent project, Paket, offers a truly command-line approach to the problem at last. You again need an .fsproj
skeleton (like this example), but you can then create a very simple dependencies file. Download the latest release of Paket from Github. Running mono paket.exe install
will then use this file to fetch the dependencies from NuGet and add them to your .fsproj
as references.
There is a bit of a bootstrapping problem, but any of these approaches should get you over the initial hump.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With