Faithlife.Build

Faithlife.Build is a build automation system using C# build scripts.

Features

This library allows developers to use C# to write build scripts. It is similar to Cake and NUKE, but simpler, providing a thin wrapper over some of the libraries acknowledged below.

Usage

To use this library for your automated build, create a .NET Core Console App project in tools/build that references the latest Faithlife.Build NuGet package. Optionally add the project to your Visual Studio solution file. See Build.csproj for an example project; there are project properties in that file that you may need for everything to work as expected.

The Main method of the console app should call BuildRunner.Execute with the args and a delegate that defines the build targets and any desired command-line options by calling methods on the provided BuildApp.

using Faithlife.Build;
using static Faithlife.Build.DotNetRunner;

internal static class Build
{
    public static int Main(string[] args) => BuildRunner.Execute(args, build =>
    {
        build.Target("build")
            .Describe("Builds the solution")
            .Does(() => RunDotNet("build", "-c", "Release", "--verbosity", "normal"));
    });
}

Perform the build by calling dotnet run on the build project, which is most easily done from a simple bootstrapper, typically named build.cmd (for Windows) and/or build.sh (for non-Windows).

Consult the full reference documentation for additional details.

.NET Targets

To create standard targets for a .NET build, call DotNetBuild.AddDotNetTargets with custom settings as needed. See Build.cs for an example.

For now, the best documentation for the supported targets and command-line options is the source code.

Acknowledgements

Special thanks to the libraries and tools used by Faithlife.Build:

Also thanks to Paul Knopf for this article, which inspired us to think beyond Cake.