Skip to content

Instantly share code, notes, and snippets.

@vilinski
Last active November 29, 2021 14:48
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 vilinski/f585d634b4270d35267e979878c1d2e4 to your computer and use it in GitHub Desktop.
Save vilinski/f585d634b4270d35267e979878c1d2e4 to your computer and use it in GitHub Desktop.
FAKE script execution context - allows to run fake script with fsi
#r "nuget: System.Reactive" // workaround for System.IO.FileNotFoundException: Could not load file or assembly
#r "nuget: Fake.Core.Target"
open System
open Fake.Core
let setScriptContext isCached scriptFile =
System.Environment.GetCommandLineArgs()
|> Array.skip 2 // skip fsi.exe; *.fsx
|> Array.toList
|> FakeExecutionContext.Create isCached scriptFile
|> Fake
|> setExecutionContext
setScriptContext false __SOURCE_FILE__
// ...
// Targets and the rest of build.fsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment