GiantCroissant.Lunar.Build.NuGet 0.1.1-ci.90

This is a prerelease version of GiantCroissant.Lunar.Build.NuGet.
dotnet add package GiantCroissant.Lunar.Build.NuGet --version 0.1.1-ci.90
                    
NuGet\Install-Package GiantCroissant.Lunar.Build.NuGet -Version 0.1.1-ci.90
                    
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="GiantCroissant.Lunar.Build.NuGet" Version="0.1.1-ci.90" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GiantCroissant.Lunar.Build.NuGet" Version="0.1.1-ci.90" />
                    
Directory.Packages.props
<PackageReference Include="GiantCroissant.Lunar.Build.NuGet" />
                    
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 GiantCroissant.Lunar.Build.NuGet --version 0.1.1-ci.90
                    
#r "nuget: GiantCroissant.Lunar.Build.NuGet, 0.1.1-ci.90"
                    
#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 GiantCroissant.Lunar.Build.NuGet@0.1.1-ci.90
                    
#: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=GiantCroissant.Lunar.Build.NuGet&version=0.1.1-ci.90&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=GiantCroissant.Lunar.Build.NuGet&version=0.1.1-ci.90&prerelease
                    
Install as a Cake Tool

NuGet Build Components

Streamlined NuGet build automation for the Lunar Build system. This module exposes small, reusable component APIs and thin orchestration workflows you can call from NUKE targets.

What You Get (Current)

  • INuGetPackager — Engines for PackComponents and PackMeta using NUKE DotNetPack.
  • IMetaPackWorkflow — Orchestrates meta packaging (sync built packages → restore meta with packageSourceMapping → pin dependency versions to GitVersion → build/pack meta).
  • IComponentPackWorkflow — Orchestrates component pre-build (analyzers off) and packing.
  • INuGetPublisher — Push packages (and symbols) with skip-duplicate and API key support.
  • ILocalFeedSync — Copy built .nupkg to one or more local repositories in flat/hierarchical/both layouts.
  • IArtifactLayout — Compute artifact directory layout (packages, reports, logs) under _artifacts/{version}.

Quick Start

Call the workflows from thin NUKE targets.

using Lunar.Build.NuGet.Api;
using Nuke.Common;
using Nuke.Common.IO;

partial class Build
{
    const string DisableGitVersionProp = "DisableGitVersion";

    Target Pack => _ => _
        .Executes(() =>
        {
            // Discover component projects and compute output dir (not shown here)
            var projects = /* glob your component csproj files */ Array.Empty<AbsolutePath>();
            var output = /* e.g. build/_artifacts/{GitVersion}/nuget-packages */ RootDirectory / "build/_artifacts/local/nuget-packages";

            var useLocalNfun = (Environment.GetEnvironmentVariable("UseLocalNfunProjectReferences") ?? "")
                .Equals("true", StringComparison.OrdinalIgnoreCase);
            var disableGitVersion = Environment.GetEnvironmentVariable(DisableGitVersionProp);
            var version = GitVersion?.SemVer;

            var props = new Dictionary<string, string>
            {
                ["RunAnalyzersDuringBuild"] = "false",
                ["RunAnalyzersDuringCompilation"] = "false",
                ["EnableNETAnalyzers"] = "false",
                ["EnforceCodeStyleInBuild"] = "false",
                ["TreatWarningsAsErrors"] = "false",
                ["ContinuousIntegrationBuild"] = "true",
                ["UpdateVersionProperties"] = "false",
                [useLocalNfun ? "UseLocalNfunProjectReferences" : "ForceNfunPackageReferences"] = "true"
            };

            var env = new Dictionary<string, string>();
            if (!string.IsNullOrWhiteSpace(disableGitVersion)) env[DisableGitVersionProp] = disableGitVersion!;

            var workflow = new ComponentPackWorkflow();
            workflow.Execute(new ComponentPackRequest
            {
                Projects = projects,
                DisableAnalyzers = true,
                BuildProperties = props,
                EnvironmentVariables = env,
                PackConfig = new PackConfig
                {
                    Configuration = "Release",
                    OutputDirectory = output,
                    NoRestore = true,
                    NoBuild = true,
                    ContinuousIntegrationBuild = true,
                    DisableAnalyzers = true,
                    Version = version,
                    PackageVersion = version,
                    AdditionalProperties = props,
                    EnvironmentVariables = env
                }
            });
        });
}

Pack meta with pinned dependency versions to the current GitVersion and restore from the synced local feed:

using Lunar.Build.NuGet.Api;

partial class Build
{
    Target PackMeta => _ => _
        .DependsOn(Pack) // ensure components built
        .Executes(() =>
        {
            var metaProject = RootDirectory / "build/nuke/Lunar.Build.csproj";
            var builtPackages = RootDirectory / "build/_artifacts/{GitVersion}/nuget-packages"; // resolve as needed
            var localRepo = RootDirectory / "packages/nuget-repo"; // workspace feed
            var version = GitVersion?.SemVer;

            var workflow = new MetaPackWorkflow();
            workflow.Execute(new MetaPackRequest
            {
                MetaProjectFile = metaProject,
                BuildPackagesDirectory = builtPackages,
                LocalRepositoryDirectory = localRepo,
                Configuration = "Release",
                Version = version,
                DisableAnalyzers = true,
                EnvironmentVariables = new Dictionary<string, string>
                {
                    ["DisableGitVersion"] = "1"
                }
            });
        });
}

Configuration

  • nuget.outputDirectory: where DotNetPack writes .nupkg (typically build/_artifacts/{GitVersion}/nuget-packages).
  • nuget.localNugetRepositories (array): local repositories to sync to. The workspace feed packages/nuget-repo/ is always included to support meta restore.
  • nuget.syncLayout: hierarchical | flat | both for local repo sync topology.
  • UseLocalNfunProjectReferences: true to opt into local project references for Nfun adapter during dev.
  • ForceNfunPackageReferences: true to force package consumption mode even when sibling repos exist locally (keeps CI/local parity).
  • DisableGitVersion: set to 1 to disable GitVersion during local test runs.

Meta pinning and local feed (per docs/guides/nuget-local-feed-and-meta-pinning.md):

  • Meta’s PackageReference versions are pinned to $(MetaDependenciesVersion), which we set to GitVersion.SemVer during PackMeta.
  • We sync freshly built component packages to the workspace local feed packages/nuget-repo/ and restore meta using a generated nuget.config with packageSourceMapping so GiantCroissant.* and Lunar.* resolve from the local feed.
  • NoRestore=true is used for the meta build/pack phases to avoid re-evaluating sources.

This preserves CI determinism while allowing local dry-runs without CI minutes.

Troubleshooting

  • NU1100 / cannot resolve GiantCroissant.*: Ensure the local feed packages/nuget-repo/ contains the just-built component packages. The meta workflow copies any missing .nupkg from the build output before restore.
  • NU1010 (PackageReference has no matching central version): In local CI-like runs we force package mode for the adapter and provide VersionOverride metadata to bind a concrete version when CPVM discovery is flaky.
  • PackageSourceMapping excludes .nuget\packages: The generated nuget.config explicitly maps GiantCroissant.*/Lunar.* to the workspace local-packages source, preventing fallbacks.

Legacy (Kept for Reference Only)

The previous service-oriented implementation (services, options, validators, DI extensions, etc.) remains in this folder but is excluded from compilation and packaging. This preserves history and reference material without increasing package surface area.

  • Excluded folders: Services, Options, DependencyInjection, Interfaces (except INuGetRepositoryComponent), Components (compiled only INuGetLocalRepoSyncComponent), Common, NugetPackage, Validation, PreBuild, PostBuild, _Generated.
  • IWorkspaceNuGetComponent is deprecated; still compiled for backward compatibility. Prefer INuGetRepositoryComponent.

If you still need the old behavior, consider copying the relevant code into your build as internal utilities rather than re-enabling it in this package.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on GiantCroissant.Lunar.Build.NuGet:

Package Downloads
GiantCroissant.Lunar.Build

Meta-package that depends on the Lunar Build component packages for one-line install.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.1-ci.90 115 9/8/2025
0.1.1-ci.40 95 9/6/2025
0.1.1-ci.21 143 9/4/2025
0.1.1-ci.20 134 9/3/2025
0.1.1-chore-ci-pack-mobile-... 27 9/4/2025

NuGet packaging components with repository management and publishing workflows for Nuke build system.