Skip to content

Instantly share code, notes, and snippets.

@kosecki123
Last active November 19, 2015 09:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kosecki123/d6e640b3eb14238b0083 to your computer and use it in GitHub Desktop.
Save kosecki123/d6e640b3eb14238b0083 to your computer and use it in GitHub Desktop.
//==========================================
// Working fully self-contained paket based script
//
// Note you don't need to have _anything_ installed before starting with this script. Nothing
// but F# Interactive and this script.
//
// This script fetches the Paket.exe component which is referenced later in the script.
// Initially the #r "paket.exe" reference is shown as unresolved. Once it has been
// downloaded by the user (by executing the first part of the script) the reference
// shows as resolved and can be used.
//
// Paket is then used to fetch a set of F# packages, which are then used later inn the script.
//
//------------------------------------------
// Step 0. Boilerplate to get the paket.exe tool
open System
open System.IO
Environment.CurrentDirectory <- __SOURCE_DIRECTORY__
if not (File.Exists "paket.exe") then
let url = "https://github.com/fsprojects/Paket/releases/download/0.26.3/paket.exe"
use wc = new Net.WebClient() in let tmp = Path.GetTempFileName() in wc.DownloadFile(url, tmp); File.Move(tmp,Path.GetFileName url)
// Step 1. Resolve and install the packages
#r "paket.exe"
Paket.Dependencies.Install """
source https://nuget.org/api/v2
nuget AnyNugetPackageNameHere
""";;
// Step 2. Use the packages
#r "packages/{path to dll}"
open {your dll namespace}
// Step 3. Do your stuff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment