Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Require dll using string path in F#

Tags:

f#

f#-fake

Is there a way to do this in F#:

let fakeToolsPath = "D:\tools\FAKE\tools\FakeLib.dll"

#r fakeToolsPath

the fake tools are on a different path depending on the build agent that builds the code, so I need to be able to set it dynamically, from an environment variable or some config file.

like image 730
ryudice Avatar asked May 04 '26 03:05

ryudice


1 Answers

Three ideas, in order of increasing hackiness - you'll be the judge which one makes most sense in your scenario:

  1. In .fsx script, you can use __SOURCE_DIRECTORY__ to get the directory where the script is located. If your dll is always located in the same directory relative to the script, you can use that as a "hook" to get to it.
  2. There's a command-line --reference argument to fsi.exe that should do what you want. If you're using fake.exe instead, you can use --fsiargs to pass it in (take a look at the link for details).
  3. If everything else fails, create a symlink as a separate build step in your CI job configuration and just hardcode the path in the script.
like image 166
scrwtp Avatar answered May 05 '26 17:05

scrwtp



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!