Nabs.Launchpad.Core.Aspire.Hosting
10.0.273
Prefix Reserved
dotnet add package Nabs.Launchpad.Core.Aspire.Hosting --version 10.0.273
NuGet\Install-Package Nabs.Launchpad.Core.Aspire.Hosting -Version 10.0.273
<PackageReference Include="Nabs.Launchpad.Core.Aspire.Hosting" Version="10.0.273" />
<PackageVersion Include="Nabs.Launchpad.Core.Aspire.Hosting" Version="10.0.273" />
<PackageReference Include="Nabs.Launchpad.Core.Aspire.Hosting" />
paket add Nabs.Launchpad.Core.Aspire.Hosting --version 10.0.273
#r "nuget: Nabs.Launchpad.Core.Aspire.Hosting, 10.0.273"
#:package Nabs.Launchpad.Core.Aspire.Hosting@10.0.273
#addin nuget:?package=Nabs.Launchpad.Core.Aspire.Hosting&version=10.0.273
#tool nuget:?package=Nabs.Launchpad.Core.Aspire.Hosting&version=10.0.273
Nabs.Launchpad.Core.Aspire.Hosting
Purpose
This package provides Aspire hosting extensions for Nabs Launchpad applications, including environment-aware App Configuration and Key Vault resources with secure, predictable conventions.
Installation
Install the package from NuGet:
dotnet add package Nabs.Launchpad.Core.Aspire.Hosting
Quick Start
using Aspire.Hosting;
using Nabs.Launchpad.Core.Aspire.Hosting;
var builder = DistributedApplication.CreateBuilder(args);
var config = builder.AddNabsConfigurationResources();
builder.AddProject<Projects.Api>("api")
.WithReference(config.AppConfiguration)
.WithReference(config.KeyVault);
builder.Build().Run();
API Overview
AddNabsConfigurationResources(...)– adds Azure App Configuration and Key Vault resources with the correct behaviour for Local, Ephemeral, and Production environments.AddNabsSecretParameter(...)– adds an Aspire secret parameter with consistent naming.WithNabsSecretEnvironment<T>(...)– injects a secret parameter as a normalised environment variable.WithNabsLocalGatewayIdentity<T>(...)– optionally wires a local Azure identity emulator for gateway OIDC flows in run mode.AddNabsPlaywrightHarnessResources<TReportHostProject>(...)– adds Playwright report host, UI, and recorder resources with gateway dependencies.AddThirdPartyService<TProject>(...)– registers a third-party service that resolves to an external URL by default and can switch to a local emulator project viaRunAsEmulator()in run mode.GetPlaywrightBaseUrlsToTest()– provides the default comma-separated base URLs for Playwright test execution.NabsConfigurationHostingOptions– customisable resource/parameter names and environment handling.NabsConfigurationResources– strongly typed wrapper for the App Configuration and Key Vault resource builders.
Playwright harness resources
using Nabs.Launchpad.Core.Aspire.Hosting;
var gatewayService = builder.AddProject<Projects.Gateway>("gateway-service", "http");
builder.AddNabsPlaywrightHarnessResources<Projects.PlaywrightReportHost>(
gatewayService,
launchProfileName: "http",
playwrightBaseUrls: PlaywrightHostingExtensions.GetPlaywrightBaseUrlsToTest());
This centralizes:
playwright-report-hostproject resourceplaywright-uiexecutable resourceplaywright-record-httpexecutable resource (explicit start)playwright-record-httpsexecutable resource (explicit start)
Environment behaviour
Third-party service registration
using Nabs.Launchpad.Core.Aspire.Hosting;
var peopleService = builder
.AddThirdPartyService<Projects.Launchpad_Harness_ThirdPartyService>("people-third-party-service", "https://api.people.example.com")
.RunAsEmulator();
builder.AddProject<Projects.Api>("api")
.WithReference(peopleService)
.WaitFor(peopleService);
Behavior:
- Run mode:
RunAsEmulator()uses the local project resource. - Publish/Deploy modes: the configured external URL is used.
| Environment | Trigger | App Configuration | Key Vault / Secrets |
|---|---|---|---|
| Local | ExecutionContext.IsRunMode |
Official emulator (.RunAsEmulator()) |
Aspire Parameters + user-secrets. Optional community Key Vault emulator. |
| Ephemeral | Publish/Deploy + environment name ≠ Production | Provision new resource | Provision new Key Vault |
| Production | Publish/Deploy + Environment.IsEnvironment("Production") |
.AsExisting(...) against shared landing-zone resource |
.AsExisting(...) against shared landing-zone Key Vault |
Production pipeline variables
Supply these parameters when deploying to Production so Aspire references the existing shared resources instead of provisioning new ones:
Parameters__appConfigName=prod-shared-appconfig
Parameters__appConfigResourceGroup=rg-landingzone-prod
Parameters__keyVaultName=prod-shared-kv
Parameters__keyVaultResourceGroup=rg-landingzone-prod
Conventions
| Convention | Default |
|---|---|
| App Configuration resource/connection name | appconfig |
| Key Vault resource/connection name | keyvault |
| Production App Config name parameter | appConfigName |
| Production App Config resource group parameter | appConfigResourceGroup |
| Production Key Vault name parameter | keyVaultName |
| Production Key Vault resource group parameter | keyVaultResourceGroup |
Secret parameters
var apiKey = builder.AddNabsSecretParameter("ApiKey");
builder.AddProject<Projects.Api>("api")
.WithNabsSecretEnvironment("Api:Key", apiKey);
This injects the value as Api__Key in the target resource environment.
You can also align parameter naming with a hierarchical configuration key:
var authKey = builder.AddNabsSecretParameter("AuthKey", "Auth:Key");
When configurationKey is provided, the parameter is normalised using : → __ conventions.
Optional local gateway identity emulation
var gateway = builder.AddProject<Projects.Gateway>("gateway");
gateway = builder.WithNabsLocalGatewayIdentity(gateway);
Enable this behavior in local profiles with NABS_USE_LOCAL_AZURE_IDENTITY_EMULATOR=true.
| Product | Versions 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. |
-
net10.0
- Aspire.Hosting (>= 13.5.3)
- Aspire.Hosting.Azure.AppConfiguration (>= 13.5.3)
- Aspire.Hosting.Azure.KeyVault (>= 13.5.3)
- Aspire.Hosting.Foundry (>= 13.5.3-preview.1.26425.3)
- Aspire.Hosting.OpenAI (>= 13.5.3)
- Azure.Identity (>= 1.21.0)
- Nabs.Launchpad.Core.Configuration (>= 10.0.273)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.