Fusonic.Extensions.Aspire.Hosting
10.3.0
Prefix Reserved
dotnet add package Fusonic.Extensions.Aspire.Hosting --version 10.3.0
NuGet\Install-Package Fusonic.Extensions.Aspire.Hosting -Version 10.3.0
<PackageReference Include="Fusonic.Extensions.Aspire.Hosting" Version="10.3.0" />
<PackageVersion Include="Fusonic.Extensions.Aspire.Hosting" Version="10.3.0" />
<PackageReference Include="Fusonic.Extensions.Aspire.Hosting" />
paket add Fusonic.Extensions.Aspire.Hosting --version 10.3.0
#r "nuget: Fusonic.Extensions.Aspire.Hosting, 10.3.0"
#:package Fusonic.Extensions.Aspire.Hosting@10.3.0
#addin nuget:?package=Fusonic.Extensions.Aspire.Hosting&version=10.3.0
#tool nuget:?package=Fusonic.Extensions.Aspire.Hosting&version=10.3.0
Aspire Hosting
Extensions for the Aspire AppHost. Tested with Aspire 13.6.
The extension methods are in the namespace Aspire.Hosting, like Aspire's own, so they are available in the AppHost without a using.
Compose stack
Aspire's containers show up in Docker Desktop as a flat list, mixed with everything else running on the machine. UseComposeStack labels them like Docker Compose does, so they are grouped as one stack:
var builder = DistributedApplication.CreateBuilder(args);
builder.UseComposeStack(); // stack "myapp" for MyApp.AppHost
var postgres = builder.AddPostgres("db")
.WithPgAdmin() // child resources are part of the stack, too
.WithComposeService("postgres"); // optional: service name other than the resource name
builder.AddContainer("mailpit", "axllent/mailpit")
.WithoutComposeStack(); // optional: leave a container out
- The stack name defaults to the AppHost's name without
.AppHost; pass one to override it:UseComposeStack("my-stack"). - Names are normalized to what Compose allows: lowercase letters, digits,
-and_. - Only in run mode;
aspire publishandaspire deployare not affected. - Changing the labels changes the configuration of a persistent container (
ContainerLifetime.Persistent), so Aspire recreates it once. Its volumes stay.
Protected secrets
When a parameter is entered in the Aspire dashboard and saved, Aspire writes it to the AppHost's user secrets: a plaintext secrets.json in the user profile. UseProtectedSecrets keeps these values in the operating system's secret store for the current user instead:
var builder = DistributedApplication.CreateBuilder(args);
builder.UseProtectedSecrets();
var apiKey = builder.AddParameter("api-key", secret: true); // entered in the dashboard as usual
- Stored secrets are loaded over the user secrets, so a stale value in
secrets.jsondoesn't win. Environment variables and command line arguments still do. - Aspire's deployment state (
aspire publish/aspire deploy) stays in the user secrets. - Where no store is available (Linux without a keyring, e.g. headless or WSL), the AppHost logs a warning at startup and uses the plaintext user secrets as before.
Where the secrets are kept
| OS | Store |
|---|---|
| Windows | File encrypted with DPAPI for the current user, in %LOCALAPPDATA%\Fusonic.Extensions.Aspire |
| macOS | Keychain, service Fusonic.Extensions.Aspire |
| Linux | Secret Service via libsecret (e.g. GNOME Keyring), schema Fusonic.Extensions.Aspire.secrets |
The AppHost's secrets are identified by its UserSecretsId (or its name, if it has none). Both can be changed:
builder.UseProtectedSecrets(options =>
{
options.Name = "my-app";
options.Directory = "/some/where"; // the encrypted file on Windows
});
Uses the cache storage of Microsoft.Identity.Client.Extensions.Msal, the maintained cross-platform wrapper around these stores.
Limitations
- Generated parameter defaults (e.g. a password Aspire generates for
AddPostgreswithout one) are still saved to the plaintext user secrets: Aspire saves them throughIDistributedApplicationBuilder.UserSecretsManager, which can't be replaced. Set such parameters explicitly (AddParameter(..., secret: true)) to keep them in the store. - Values already in
secrets.jsonstay there. Remove them by hand (dotnet user-secrets remove <key>) after entering them again in the dashboard. - Builds on Aspire's experimental
IUserSecretsManager(ASPIREUSERSECRETS001). A newer Aspire version may need a new version of this package.
| 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.6.4)
- Microsoft.Extensions.Configuration (>= 10.0.14)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 10.0.14)
- Microsoft.Extensions.Configuration.FileExtensions (>= 10.0.14)
- Microsoft.Extensions.Configuration.Json (>= 10.0.14)
- Microsoft.Extensions.Configuration.UserSecrets (>= 10.0.14)
- Microsoft.Extensions.DependencyInjection (>= 10.0.14)
- Microsoft.Extensions.Http (>= 10.0.14)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.14)
- Microsoft.Extensions.Logging.Console (>= 10.0.14)
- Microsoft.Identity.Client.Extensions.Msal (>= 4.92.0)
- Newtonsoft.Json (>= 13.0.4)
- OpenTelemetry.Api (>= 1.20.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.3.0 | 52 | 11/9/2026 |