Skip to main content
Total Downloads
18.2K
18,231
Published
May 16, 2026
5mo ago

Get Started

dotnet add package CP.Nuke.BuildTools --version 3.0.2
ProductVersions
.NET
net10.0

README

License Build Nuget NuGet

CP.Nuke.BuildTools

CP.Nuke.BuildTools adds pragmatic helpers around NUKE for modern .NET cloud builds. The package tracks current Nuke.Common usage while filling gaps around .slnx discovery, project metadata, GitHub Actions output, and build automation ergonomics.

Install

Add the package to your NUKE build project, usually build/_build.csproj:

dotnet add build/_build.csproj package CP.Nuke.BuildTools

Then import the namespace in Build.cs:

using CP.BuildTools;

Current Focus

  • TUnit tests running through Microsoft Testing Platform.
  • .slnx-aware solution discovery and project listing without replacing NUKE's own solution model.
  • Project metadata helpers for packable, test, executable, publishable, web, worker, Windows desktop, MAUI, container-enabled, target framework, runtime identifier, package reference, and project reference checks.
  • Safer GitHub Actions helpers, including multiline-safe GITHUB_OUTPUT writes and escaped log annotations.
  • Cache key patterns that include .slnx, solution files, project files, props/targets, package management, lock files, and NuGet config.
  • NUKE workload restore wrappers using DotNetWorkloadRestore instead of ad hoc shell commands.

Common Helpers

Method Purpose
PublicNuGetSource() Returns the public NuGet v3 source URL.
ResolveSolutionFile(...) Finds a single .slnx/.sln, preferring .slnx when appropriate.
DiscoverSolutionFiles(...) Lists solution files under a root directory.
ListSolutionProjectPaths(...) Uses dotnet sln list for .slnx/.sln project paths.
ReadProjectInfo(...) Reads SDK-style project metadata from a project file.
ReadSolutionProjectInfos(...) Reads metadata for projects in a solution.
GetPackableProjects() / GetTestProjects() Filters NUKE solution projects.
GetPublishableProjectInfos() Finds publishable app-like projects from metadata.
GitHubSetOutput() Writes single-line or multiline GitHub Actions outputs safely.
GitHubActionsHashFilesExpression() Produces an Actions hashFiles(...) expression using modern cache inputs.
RestoreProjectWorkload() / RestoreSolutionWorkloads() Runs dotnet workload restore through NUKE's DotNet wrapper.

Example

[Solution] readonly Solution Solution = null!;

Target Info => _ => _
    .Executes(() =>
    {
        var projectInfos = Solution.Path.ReadSolutionProjectInfos();

        Log.Information("NuGet: {Source}", this.PublicNuGetSource());
        Log.Information("Tests: {Projects}", string.Join(", ", Solution.GetTestProjects().Select(x => x.Name)));
        Log.Information("Publishable: {Projects}", string.Join(", ", projectInfos.GetPublishableProjectInfos().Select(x => x.Name)));
    });

Demo

A multi-project demo lives in samples/Demo. It includes Console, ASP.NET Web API, Blazor, Worker, gRPC, WPF, WinForms, MAUI Windows, Avalonia, a shared library, and TUnit tests.

Run it from the repository root:

dotnet run --project samples/Demo/build/_build.csproj -- --target Default

The demo uses samples/Demo/Demo.slnx and its NUKE build prints project filters from this package before building and testing the sample graph.

Test Platform

The repository uses TUnit with Microsoft Testing Platform. global.json opts dotnet test into the MTP runner for .NET 10 SDKs:

dotnet test src/CP.Nuke.BuildTools.slnx

Notes

  • Nuke.Common remains the source of truth for solution/project loading; this package adds discovery and metadata helpers around it.
  • Methods that update Visual Studio, install SDKs/runtimes, call GitHub APIs, or upload release assets have external side effects and should be used intentionally in CI.
  • The demo currently restores with an Avalonia transitive advisory warning for Tmds.DBus.Protocol from the Avalonia package graph.

License

MIT. See LICENSE.

Downloads by Version

Similar & Alternative Packages

Hand-picked matching NuGet libraries based on tags & ecosystem

Depended On By

Find packages that declare this package as a dependency. NuGet does not provide a reverse-dependency endpoint, so candidates are checked on demand.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

Compatibility metadata lists 1 target framework; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.