FluentUIScaffold.AspireHosting 1.0.1

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

FluentUIScaffold.AspireHosting

.NET Aspire hosting integration for FluentUIScaffold. Enables distributed application testing using Aspire's DistributedApplicationTestingBuilder.

Installation

dotnet add package FluentUIScaffold.AspireHosting

Requires FluentUIScaffold.Core, Docker, the Aspire workload, and .NET 8+.

Usage

var app = new FluentUIScaffoldBuilder()
    .UsePlaywright()
    .UseAspireHosting<Projects.MyApp_AppHost>(
        appHost => { },
        "resourcename")
    .Web<WebApp>(options => { })
    .Build<WebApp>();

Common gotchas

Docker daemon must be running

UseAspireHosting<TAppHost>() requires Docker (or a compatible runtime such as Rancher Desktop or Podman with Docker compatibility). Before booting the Aspire AppHost, FluentUIScaffold runs a 2-second docker info probe and throws a clear, single-line InvalidOperationException if the daemon is unreachable — instead of letting Aspire hang and bury the real cause ~20 stack frames deep behind DistributedApplicationFactory → DcpHost → DcpDependencyCheck.

Common reasons the probe fails:

  • Docker Desktop / Rancher Desktop is not started.
  • Docker Desktop is in Resource Saver mode — click the tray icon to wake it. (After a host crash, Docker Desktop can land in Resource Saver and stay there silently, which previously turned every dotnet test invocation into an indefinite hang.)
  • The Docker daemon crashed.

If you genuinely want to bypass the local probe — for example because Aspire is talking to a remote daemon via DOCKER_HOST — opt out with .SkipDockerPreflightCheck():

var app = new FluentUIScaffoldBuilder()
    .UsePlaywright()
    .UseAspireHosting<Projects.MyApp_AppHost>(appHost => { }, "web")
    .SkipDockerPreflightCheck()
    .Web<WebApp>(options => { })
    .Build<WebApp>();

HTTPS redirect + YARP + SPA CSP

Many ASP.NET Core templates ship with app.UseHttpsRedirection() enabled. In the Testing environment it issues a 307 Temporary Redirect to the absolute HTTPS upstream URL (e.g. https://localhost:7039/api/...). When the API sits behind a YARP reverse proxy serving an SPA, the browser sees the absolute redirect and the SPA's CSP connect-src 'self' blocks the follow-up request, producing a cryptic "Failed to fetch" in every test.

Opt in to HTTP-only mode to short-circuit this:

var app = new FluentUIScaffoldBuilder()
    .UsePlaywright()
    .WithHttpOnlyMode()                // <-- inject ASPNETCORE_URLS=http://+:0 + clear ASPNETCORE_HTTPS_PORT
    .UseAspireHosting<Projects.MyApp_AppHost>(appHost => { }, "web")
    .Web<WebApp>(options => { })
    .Build<WebApp>();

This injects two env vars into every Aspire-hosted process:

  • ASPNETCORE_URLS=http://+:0 — Aspire picks the port; no HTTPS endpoint is advertised.
  • ASPNETCORE_HTTPS_PORT= (empty) — disables UseHttpsRedirection's port resolution.

Off by default — opt-in only, since it changes wire-protocol expectations.

Configurable startup timeout + heartbeat

Aspire AppHost startup is bounded to 90 seconds by default. If startup doesn't complete in that window, FluentUIScaffold throws a TimeoutException naming the timeout duration, instead of hanging indefinitely with no signal.

While startup is in progress, FluentUIScaffold emits an ILogger.LogInformation line every 10 seconds — "Aspire host starting... ({elapsed}s elapsed)" — so you can tell whether startup is making progress or stuck.

If your AppHost genuinely needs longer (e.g., a heavy database seed):

var app = new FluentUIScaffoldBuilder()
    .UsePlaywright()
    .UseAspireHosting<Projects.MyApp_AppHost>(appHost => { }, "web")
    .WithAspireStartupTimeout(TimeSpan.FromMinutes(3))
    .Web<WebApp>(options => { })
    .Build<WebApp>();

Documentation

For full documentation, examples, and guides, visit the GitHub repository.

License

This project is licensed under the MIT License. See the LICENSE.md file for details.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  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

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
1.0.1 87 10/12/2026
0.4.3-preview-20260601-040926 133 6/1/2026
0.4.2-preview-20260518-100634 140 5/18/2026
0.4.1 23,378 3/9/2026
0.3.22-preview-20260218-145936 141 2/18/2026
0.3.21-preview-20260215-142850 133 2/15/2026
0.3.20-preview-20260211-181404 137 2/11/2026
0.3.19-preview-20260114-143643 163 1/14/2026
0.3.18-preview-20260114-124017 141 1/14/2026
0.3.17-preview-20260114-074754 149 1/14/2026
0.3.14-preview-20260114-063732 146 1/14/2026