![]() |
VOOZH | about |
dotnet add package Faithlife.Build --version 5.31.0
NuGet\Install-Package Faithlife.Build -Version 5.31.0
<PackageReference Include="Faithlife.Build" Version="5.31.0" />
<PackageVersion Include="Faithlife.Build" Version="5.31.0" />Directory.Packages.props
<PackageReference Include="Faithlife.Build" />Project file
paket add Faithlife.Build --version 5.31.0
#r "nuget: Faithlife.Build, 5.31.0"
#:package Faithlife.Build@5.31.0
#addin nuget:?package=Faithlife.Build&version=5.31.0Install as a Cake Addin
#tool nuget:?package=Faithlife.Build&version=5.31.0Install as a Cake Tool
Faithlife.Build is a build automation system using C# build scripts.
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.
Most importantly, since the build script is a full-fledged .NET app with access to any compatible NuGet package, you can do just about anything, in a language and framework you already know well.
To use this library for your automated build, create a .NET 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.
The Main method of the console app should call BuildRunner.Execute or BuildRunner.ExecuteAsync 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 running the Build project. This can be done directly via dotnet run, e.g. dotnet run --project tools/Build -- test, but builds are more easily run from a simple bootstrapper, usually named build.ps1, build.cmd, and/or build.sh.
Specify the desired targets on the command line, e.g. ./build package. Use --help to list the available build targets and command-line options. These command-line arguments are always supported:
-n or --dry-run : Don't execute target actions.-s or --skip-dependencies : Don't run any target dependencies.--skip <targets> : Skip the comma-delimited target dependencies.--parallel : Run targets in parallel.--no-color : Disable color output.--show-tree : Show the dependency tree.--verbose : Show verbose output.-? or -h or --help : Show build help.Consult the source code for additional details.
To create standard targets for a .NET build, call DotNetBuild.AddDotNetTargets with custom settings as needed. See Build.cs for an example.
The supported targets include:
clean : Deletes all build output.restore : Restores NuGet packages.build : Builds the solution.test : Runs the unit tests.coverage : Runs tests with coverage and generates coverage reports, if coverage settings are configured or coverage.runsettings exists.package : Builds NuGet packages.publish : Publishes NuGet packages and documentation.cleanup : Runs JetBrains CleanupCode if jetbrains.resharper.globaltools is installed as a local or global tool, or if solution settings are present.inspect : Runs JetBrains InspectCode if jetbrains.resharper.globaltools is installed as a local or global tool, or if solution settings are present.The supported command-line options include:
-c <name> or --configuration <name> : The configuration to build (default Release).-p <name> or --platform <name> : The solution platform to build.-v <level> or --verbosity <level> : The build verbosity (q[uiet], m[inimal], n[ormal], d[etailed]).--version-suffix <suffix> : Generates a prerelease NuGet package.--nuget-output <path> : Directory for the generated NuGet package (default release).--trigger <name> : The git branch or tag that triggered the build.--build-number <number> : The automated build number.--no-test : Skip the unit tests.The supported DotNetBuildSettings include:
SolutionName : The name of the solution file; defaults to the only solution in the directory.SolutionPlatform : The default solution platform to build.Verbosity : The default build verbosity.NuGetApiKey : The NuGet API key with which to push packages.NuGetSource : The NuGet source to which to push packages, if not the standard source.DocsSettings : Used to generate Markdown documentation from XML comments.MSBuildSettings : Set to use MSBuild instead of dotnet to build the solution.TestSettings : Settings for running unit tests.CoverageSettings : Settings for running unit tests with coverage.PackageSettings : Settings for creating and publishing NuGet packages.CleanSettings : Settings for cleaning projects.MaxCpuCount : The maximum number of CPUs to use when building.ExtraProperties : A function that returns any extra properties for the specified build target.ShowSummary : True if a build summary should be displayed.BuildNumber : The build number, if not specified on the command line.For details on exactly what each target does and how the settings and command-line options affect the build, read the DotNetBuild source code.
When using DotNetBuild.AddDotNetTargets, Faithlife.Build will set the following MSBuild properties automatically; you should not set them in Project.csproj or Directory.Build.props:
AllowedOutputExtensionsInPackageBuildOutputFolder: set to include .pdb files.AssemblyVersion: set to $(VersionPrefix).$(BuildNumber) if BuildNumber is provided.ContinuousIntegrationBuild: set to true if a CI environment is detected.PublishRepositoryUrl: set to true to include repository URL in NuGet package metadata.Additionally, this property and item come from the .NET SDK and should not be set manually:
EmbedUntrackedFiles: set to true.SourceLinkGitHubHost: ContentUrl="https://raw.githubusercontent.com" is added for GitHub.com repositories.To check the exact MSBuild properties and items being used, read the Runtime.Directory.Build.targets source code.
If a package reuses the repository README.md as its NuGet package README, relative links in that README will not work when rendered on nuget.org. Set RewritePackageReadmeLinks to true to generate a package-specific copy of the README during dotnet pack; repository-relative Markdown links are rewritten to absolute GitHub links, while same-document anchors and absolute links are left unchanged.
<PropertyGroup>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RewritePackageReadmeLinks>true</RewritePackageReadmeLinks>
</PropertyGroup>
<ItemGroup>
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
</ItemGroup>
The generated README is packed as README.md; the source README remains unchanged. The package project must set RepositoryUrl or equivalent repository metadata so the generated links can point to the correct GitHub repository.
Set DotNetBuildSettings.CoverageSettings, or place coverage.runsettings in the working directory, to add a standard coverage target that runs test projects under tests/**/*.csproj with Coverlet and generates reports with dotnet dnx dotnet-reportgenerator-globaltool.
build.AddDotNetTargets(new DotNetBuildSettings
{
CoverageSettings = new DotNetCoverageSettings
{
TargetFramework = "net10.0",
},
});
The target writes test results under artifacts/Coverage/TestResults, writes reports to artifacts/Coverage/Report, and uses coverage.runsettings automatically when that file exists. Each run uses a fresh test-results subdirectory so stale coverage files are not included.
See Contributing for setup and contribution guidelines. For a history of notable changes, see the Release Notes.
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.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
Showing the top 1 popular GitHub repositories that depend on Faithlife.Build:
| Repository | Stars |
|---|---|
|
ejball/XmlDocMarkdown
Generates Markdown from .NET XML documentation comments.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 5.31.0 | 7,541 | 5/27/2026 |
| 5.31.0-beta.2 | 57 | 5/27/2026 |
| 5.31.0-beta.1 | 61 | 5/27/2026 |
| 5.30.1 | 399 | 5/27/2026 |
| 5.30.0 | 691 | 5/25/2026 |
| 5.30.0-beta.1 | 60 | 5/25/2026 |
| 5.29.1 | 215 | 5/24/2026 |
| 5.29.0 | 311 | 5/23/2026 |
| 5.28.3 | 6,261 | 4/24/2026 |
| 5.28.2 | 8,552 | 4/15/2026 |
| 5.28.1 | 13,212 | 2/15/2026 |
| 5.28.0 | 15,722 | 1/22/2026 |
| 5.27.1 | 501 | 1/21/2026 |
| 5.27.0 | 1,066 | 1/19/2026 |
| 5.26.2 | 1,802 | 1/12/2026 |
| 5.26.1 | 94,447 | 2/14/2025 |
| 5.26.0 | 610 | 2/14/2025 |
| 5.25.0 | 55,174 | 10/7/2024 |
| 5.24.0 | 3,257 | 9/24/2024 |
| 5.23.0 | 23,952 | 7/12/2024 |