Xake 4.0.0

dotnet add package Xake --version 4.0.0
                    
NuGet\Install-Package Xake -Version 4.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Xake" Version="4.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Xake" Version="4.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Xake" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Xake --version 4.0.0
                    
#r "nuget: Xake, 4.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Xake@4.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Xake&version=4.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Xake&version=4.0.0
                    
Install as a Cake Tool

Xake is a build utility that uses the full power of the F# programming language. Xake is inspired by shake build tool.

Build and Test

Sample script

A script that builds a .NET project with the SDK, and only when it has to:

#r "nuget: Xake, 4.0.0"

open Xake
open Xake.Tasks

let vars = {|
    // -d CONFIGURATION=Debug, or XAKE__CONFIGURATION in the environment
    config = Var.string(name = "CONFIGURATION") |> withDefault "Release"
|}

do xakeScript {
    varschema vars

    command "main" { do! need ["out/app.dll"] }

    // rebuilt only when a source file, the project or CONFIGURATION changes
    target "out/app.dll" {
        let! config = vars.config
        let! sources = getFiles (!! "app/**/*.cs" ++ "app/*.csproj" -- "app/obj/" -- "app/bin/")
        do! needFiles sources
        do! sh "dotnet build app" { args ["-c"; config; "-o"; "out"] }
    }

    command "clean" { do! rm { dir "out" } }
}

Next to a project made with dotnet new console -n app, dotnet fsi build.fsx builds out/app.dll; run it again and it reports Skipped ... (up to date). Rules are written straight in the body of xakeScript, sh runs a process and fails the build on a non-zero exit code, and the variables are declared once and listed by dotnet fsi build.fsx -- -- --help (docs/variables.md).

The Xake package is the build engine alone (Xake, Xake.Tasks). The .NET tasks (csc, fsc, msbuild, resgen, hermetic builds) live in the Xake.Dotnet package, built from its own repository, https://github.com/OlegZee/Xake.Dotnet, and published with 4.0.0: add #r "nuget: Xake.Dotnet, 4.0.0" and open Xake.Dotnet to use them.

Getting started

Make sure dotnet SDK 8.0 or newer is installed. Save any of the scripts below as build.fsx and run it with dotnet fsi build.fsx — Xake comes from NuGet, there is nothing else to install.

1. Hello world

The smallest useful script: one command, printing a message. main is the default target, so no arguments are needed.

#r "nuget: Xake"

open Xake

do xakeScript {
    command "main" { do! trace Message "Hello world!" }
}

2. A rule that produces a file

target declares a file target. The recipe writes the target file, and main demands it — targets are built on demand, and only the ones that are actually needed.

#r "nuget: Xake"

open Xake
open Xake.Tasks

do xakeScript {
    command "main" { do! need ["out/hello.txt"] }

    target "out/hello.txt" { do! writeText "Hello world!" }

    command "clean" { do! rm { dir "out" } }
}
dotnet fsi build.fsx            # builds "main"
dotnet fsi build.fsx -- -- clean

3. A recipe with dependencies

A recipe { ... } is a sequence of steps. Anything it reads through Xake — readText here — is recorded as a dependency, so the target is rebuilt when, and only when, one of its inputs changes.

#r "nuget: Xake"

open Xake
open Xake.Tasks

do xakeScript {
    command "main" { do! need ["out/hello.txt"] }

    target "out/hello.txt" {
        // records name.txt as a dependency of this target
        let! name = readText "name.txt"

        do! trace Info "greeting %s" (name.Trim())
        do! writeText $"Hello, {name.Trim()}!"
    }

    command "clean" { do! rm { dir "out" } }
}

Create name.txt next to the script and run it twice: the second run reports Skipped main (up to date). Change name.txt and it rebuilds.

More samples

git clone https://github.com/OlegZee/Xake
cd xake
dotnet fsi build.fsx -- -- build      # features.fsx uses the local build
cd samples
dotnet fsi gettingstarted.fsx
dotnet fsi features.fsx

Samples of the .NET tasks (csc, fsc, hermetic builds) are in the Xake.Dotnet repository.

Further reading

  • See the features.fsx script for various samples.
  • See docs/tasks.md for the task reference.
  • Xake.Dotnet: the .NET tasks (csc, fsc, msbuild, resgen, project descriptions) and the hermetic library (lock files, restore from a lock, deterministic packs, SBOMs and signing), one package with its own repository and docs.
  • Roadmap: what is planned and what is open for Xake.
  • We have the introduction page for you to learn more about Xake.
  • And there're the documentation notes for more details.

Build the project

Once you cloned the repository you are ready to compile and test the binaries:

dotnet fsi build.fsx -- -- build test

... or use build.cmd (build.sh) in the root folder. build.fsx drives dotnet build, the tests and dotnet pack; packages and releases come from it.

Releases are published to nuget.org by CI from a v* tag — see docs/devprocess.md for the packaging and release procedure.

Building .NET targets

The csc, fsc, msbuild and resgen tasks build .NET and full-framework binaries on any OS with nothing installed beyond the .NET SDK. They are the Xake.Dotnet package (from 4.0.0; #r "nuget: Xake.Dotnet, 4.0.0", which brings Xake with it), developed in its own repository, https://github.com/OlegZee/Xake.Dotnet, together with the hermetic build library and their documentation.

Documentation

See documentation for more details.

References

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Xake:

Package Downloads
Xake.Dotnet

Xake build tool: the .NET tasks (csc, fsc, msbuild, resgen, project descriptions) and reproducible builds (lock files, restore, SBOM, verification, packing, signing)

Xake.Hermetic.Dotnet

Reproducible .NET builds for Xake: lock files, restore, SBOM, verification, packing and signing

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.0 100 11/3/2026
4.0.0-preview.3 63 11/3/2026
4.0.0-preview.2 44 11/3/2026
4.0.0-preview.1 37 11/3/2026
3.15.0 338 10/29/2026
3.14.0.45 275 10/28/2026
3.13.0.43 215 10/26/2026
3.12.0.42 97 10/25/2026
3.11.0.40 189 10/22/2026
3.10.1.38 104 10/21/2026
3.10.0.35 361 10/20/2026
3.9.1.33 117 10/18/2026
3.9.0.30 317 10/18/2026
3.8.0.29 114 10/17/2026
3.7.0.26 361 10/12/2026
3.6.0.24 185 10/10/2026
3.5.0.23 149 10/4/2026
3.4.0.21 302 10/1/2026
3.3.0.20 140 9/5/2026
3.2.0.19 165 6/2/2026
Loading failed