2

I'm starting to experiment with F# and FAKE and Paket. I'm trying to understand how I should manage references to DLLs installed via Paket.

Currently I have something like this in my build.fsx

Target "DeadLetter" (fun _ ->
    ["MyFile.fs"] 
    |> FscHelper.compile [ 
        FscHelper.References [ "packages/Suave/lib/net40/Suave.dll" ]
    ]
    |> function _ -> ()
)

There is also an equivalent netstandard1.6 path but my project doesn't compile if use this. I think I hazily understand why this is the case - but I presume that someone else compiling the project might be using Standard .NET and the current configuration would fail for them.

This suggests that hardcoding the path here (albeit relative to the project root) is not the right way to do this.

How should these references be set up in the build script so the project is portable?

geoff_h
  • 1,245
  • 8
  • 13
  • 1
    Any reason not to use an `fsproj` file? – Fyodor Soikin Mar 05 '17 at 21:00
  • @FyodorSoikin I am using Mono and I don't have VS installed. I realize that this doesn't preclude using an `fsproj` but it feels like it should be do-able without. – geoff_h Mar 05 '17 at 21:17
  • 1
    The whole point of this file is to specify these intricate relationships between references, configurations, and some other things. It just so happens that VS uses this file as well, but that not the only reason to have it. And yes, of course you can replicate the functionality of `fsproj` in your build script, but why should you? Only if you have a good reason _not_ to have the `fsproj` file. Which is why I asked if you had one. – Fyodor Soikin Mar 05 '17 at 22:49
  • 1
    @geoff_h FAKE's MSBuild helpers work on Mono too, they use `xbuild` tool to build projects and solutions. I would agree with @FyodorSoikin here: unless there is a particularly good reason, I'd use `fsproj` file to describe the dependencies. – Honza Brestan Mar 06 '17 at 09:08
  • 1
    I'd suggest cloning https://github.com/fsprojects/ProjectScaffold and using that as the starting point for your project. It sets up a lot of things (`.fsproj` files, unit tests, Paket and FAKE) for you, and gives you a good starting point to work from. Even if you want to do it all "from scratch" so you learn all the details, having a known-to-work example to read is immensely helpful. – rmunn Mar 07 '17 at 09:23
  • Thanks all. I have added Forge ( http://forge.run ) to my toolkit - which generates the `.fsproj` for me although it requires a bit of modification to get it building against .NETStandard. On reflection, using xbuild to manage the dependencies and FAKE to automate the build feels like using the right tool for the right job. – geoff_h Mar 08 '17 at 08:40

0 Answers0