ForgeTrust.AppSurface.Core 0.1.0-preview.2

This is a prerelease version of ForgeTrust.AppSurface.Core.
There is a newer version of this package available.
See the version list below for details.
dotnet add package ForgeTrust.AppSurface.Core --version 0.1.0-preview.2
                    
NuGet\Install-Package ForgeTrust.AppSurface.Core -Version 0.1.0-preview.2
                    
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="ForgeTrust.AppSurface.Core" Version="0.1.0-preview.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ForgeTrust.AppSurface.Core" Version="0.1.0-preview.2" />
                    
Directory.Packages.props
<PackageReference Include="ForgeTrust.AppSurface.Core" />
                    
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 ForgeTrust.AppSurface.Core --version 0.1.0-preview.2
                    
#r "nuget: ForgeTrust.AppSurface.Core, 0.1.0-preview.2"
                    
#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 ForgeTrust.AppSurface.Core@0.1.0-preview.2
                    
#: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=ForgeTrust.AppSurface.Core&version=0.1.0-preview.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=ForgeTrust.AppSurface.Core&version=0.1.0-preview.2&prerelease
                    
Install as a Cake Tool

ForgeTrust.AppSurface.Core

The foundation of the AppSurface ecosystem. This package defines the core abstractions, the startup pipeline, and the module system that powers all other AppSurface libraries.

Overview

The Core library is designed to be lightweight and implementation-agnostic. It provides the infrastructure to:

  • Define Modules (IAppSurfaceModule, IAppSurfaceHostModule) that encapsulate logic.
  • Manage Dependency Graphs between modules.
  • Provide a consistent Startup Pipeline (AppSurfaceStartup) that sits on top of the .NET Generic Host.

Key Concepts

  • IAppSurfaceModule: The base interface for any unit of functionality that needs to register services or configure the application.
  • StartupContext: Provides metadata about the running application, including the user-facing application label, assembly-backed host identity, application discovery assembly, environment, and startup-level console output mode.
  • ConsoleOutputMode: Shared core enum that lets console-oriented packages describe whether command output should remain host-centric or command-first.
  • AppSurfaceStartup: The base class that orchestrates the host building and service registration process.

Application labels and host identity

StartupContext.ApplicationName is a display label. Use it for generated documentation titles, command output, OpenAPI branding, and other user-facing product surfaces.

StartupContext.HostApplicationName is the assembly-backed identity assigned to IHostEnvironment.ApplicationName and the Generic Host applicationName setting. It defaults to the process entry assembly when one is available so cross-assembly hosts still resolve the correct static web asset manifest. When StartupContext.OverrideEntryPointAssembly is set, it uses that override assembly name instead. If no entry assembly is available, AppSurface falls back to the root module assembly as a defensive last resort.

StartupContext.EntryPointAssembly is the assembly AppSurface scans for application-owned commands, MVC application parts, Aspire components, and similar extensibility points. It defaults to the root module assembly so test runners and shared outer hosts do not accidentally scan the xUnit/VSTest process entry assembly. When StartupContext.OverrideEntryPointAssembly is set, that override applies to both discovery and host manifest identity.

Keep these values separate. ASP.NET static web assets use the host application name to find runtime manifests. Passing a custom display label such as CustomDocsHost into the host environment can make static asset requests resolve against a manifest that does not exist. When a test or custom host needs a different manifest identity, set StartupContext.OverrideEntryPointAssembly instead of overloading ApplicationName.

Logging in Static Utilities

Core static utilities stay host-agnostic: they do not reach into a global logger, service provider, or ambient startup state. When a public static helper has useful diagnostics, expose an additive overload with an explicit non-null ILogger parameter and keep the existing no-logger overload silent. Private shared implementations may accept ILogger? only to avoid duplicating logic between the silent and diagnostic paths.

Use this pattern when a helper performs fallback behavior that callers may want to audit. For example, PathUtils.FindRepositoryRoot(startPath, logger) logs a warning when startPath does not exist and repository-root discovery has to continue from the nearest existing ancestor.

Prefer ordinary dependency injection for services, modules, hosted services, and application-owned classes. The optional logger pattern is only for static helpers where injecting a service instance would make the API harder to use or force unrelated callers to construct infrastructure.

Define static helper log messages with the source-generated [LoggerMessage] attribute on private static partial methods. Give each message a stable event ID, level, and template. Do not use ad hoc logger.Log... calls for new Core diagnostics when the message is part of an intentional API behavior.

Pitfalls:

  • Do not create a static LoggerFactory inside a utility. That couples Core to a console/logging policy the host did not choose.
  • Do not throw only because a fallback warning was logged. Keep the documented return behavior unless the input contract itself is invalid.
  • Do not swallow cleanup failures silently when a logger is available. Log them at Debug when they are intentionally suppressed to preserve the primary exception or cancellation path.

Usage

Most users will use a more specialized package like ForgeTrust.AppSurface.Web or ForgeTrust.AppSurface.Console, which inherit from the abstractions provided here.


🏠 Back to Root

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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 (15)

Showing the top 5 NuGet packages that depend on ForgeTrust.AppSurface.Core:

Package Downloads
ForgeTrust.AppSurface.Web.Tailwind

ForgeTrust.AppSurface.Web.Tailwind package for AppSurface application composition.

ForgeTrust.AppSurface.Web

ForgeTrust.AppSurface.Web package for AppSurface application composition.

ForgeTrust.AppSurface.Console

ForgeTrust.AppSurface.Console package for AppSurface application composition.

ForgeTrust.AppSurface.Config

ForgeTrust.AppSurface.Config package for AppSurface application composition.

ForgeTrust.AppSurface.Auth

ForgeTrust.AppSurface.Auth package for AppSurface application composition.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0-preview.2 342 7/3/2026
0.2.0-preview.1 638 6/28/2026
0.1.0 347 7/2/2026
0.1.0-rc.4 767 6/16/2026
0.1.0-rc.3 453 6/8/2026
0.1.0-rc.2 501 6/3/2026
0.1.0-rc.1 306 5/31/2026
0.1.0-preview.4 414 5/25/2026
0.1.0-preview.3 105 5/20/2026
0.1.0-preview.2 109 5/14/2026