Hacking Fake.Build for net7.0
It's too early yet to do the AltCover after-action for net7.0
like I did for net5.0
; but it is proving a slog like net5.0
rather than being too transparent to mention like net6.0
was.
While the dotnet
7.0.100 build has its own problems, the Fake
build system currently (5.23.x, 6.0 alpha) doesn't handle it at all - the former may work for limited scenarios, but more complicated ones fall over with library version mismatches; the latter politely askes for a v6 runtime and stops.
So, you have a build process based on a Fake script, but want to run with v7.0.100 as SDK, through your project global.json
. What do?
Well, the Fake documentation gives some alternatives - turn the script into a net7.0
project that links against the Fake libraries; but that imposes some restrictions on how you set up targets, because you can only define such things (as opposed to the functions that define the target's intended action) after setting up a build context. Or you can run as a fsi script, but the documentation then leads into how to hack paket
into the mix.
However, since net5.0, scripts are able to reference nuget
packages directly, so rather than having a paket.dependencies
, with a #r "paket: groupref [whatever] //"
, and a call out to paket
on the command line, your scripts can be self-contained, with a block of #r "nuget: [library][, optional version]
" lines at the top, and a command line that is just dotnet fsi [my fake script.fsx]
And doing it this way, you can build on the net7.0
runtime.