Aspire.Hosting.Testing 13.6.0

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

Aspire.Hosting.Testing

Use this package to write integration tests that start an Aspire AppHost and interact with its resources. It works with .NET test frameworks such as xUnit.net, NUnit, and MSTest.

Getting started

Prerequisites

A .NET test project and an Aspire AppHost project. The test machine needs the same tools as running the AppHost normally, including a container runtime if the application uses containers.

Install the package

From your test project directory, add Aspire.Hosting.Testing and a project reference to the AppHost:

dotnet add package Aspire.Hosting.Testing
dotnet add reference ../MyApp.AppHost/MyApp.AppHost.csproj

Use the same Aspire package version as your AppHost. Install this package in the test project, not the AppHost.

Usage example

The following xUnit.net test starts the AppHost, waits for its webfrontend resource to become healthy, and sends an HTTP request:

using System.Net;
using Aspire.Hosting;
using Aspire.Hosting.Testing;
using Xunit;

public class AppHostTests
{
    [Fact]
    public async Task WebFrontendReturnsOk()
    {
        using var startupTimeout = new CancellationTokenSource(TimeSpan.FromMinutes(2));
        await using var builder = await DistributedApplicationTestingBuilder
            .CreateAsync<Projects.MyApp_AppHost>(startupTimeout.Token);
        await using var app = await builder.BuildAsync(startupTimeout.Token);
        await app.StartAsync(startupTimeout.Token);

        using var requestTimeout = new CancellationTokenSource(TimeSpan.FromMinutes(1));
        await app.ResourceNotifications.WaitForResourceHealthyAsync(
            "webfrontend", requestTimeout.Token);

        using var client = app.CreateHttpClient("webfrontend");
        using var response = await client.GetAsync("/", requestTimeout.Token);

        Assert.Equal(HttpStatusCode.OK, response.StatusCode);
    }
}

Replace Projects.MyApp_AppHost with the generated project type for your AppHost, and webfrontend with a resource that returns HTTP 200 at /. Configure a health check on that resource so the readiness wait reflects when it can serve requests.

The testing builder randomizes proxied ports and disables the dashboard by default. Disposing the application and builder cleans up the resources started by the test.

Additional documentation

Feedback & contributing

https://github.com/microsoft/aspire

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 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 (18)

Showing the top 5 NuGet packages that depend on Aspire.Hosting.Testing:

Package Downloads
TUnit.Aspire.Core

A .NET Testing Framework

rbkApiModules.Testing.Core

Package Description

FluentUIScaffold.AspireHosting

FluentUIScaffold AspireHosting

Nabs.Launchpad.Core.Testing

Package Description

Hexalith.EventStore.Testing.Integration

Integration-test harness for DAPR-backed Hexalith domain modules — local daprd sidecar bootstrap, placement/scheduler endpoint resolution, Aspire topology fixtures, and support-safe diagnostics for .NET event sourcing. Domain modules supply only their AppHost type, resource names, and domain-service registration; the generic machinery is reused.

GitHub repositories (28)

Showing the top 20 popular GitHub repositories that depend on Aspire.Hosting.Testing:

Repository Stars
jasontaylordev/CleanArchitecture
Clean Architecture Solution Template for ASP.NET Core
ardalis/CleanArchitecture
Clean Architecture Solution Template: A proven Clean Architecture Template for ASP.NET Core 10
microsoft/fluentui-blazor
Microsoft Fluent UI Blazor components library. For use with ASP.NET Core Blazor applications
thomhurst/TUnit
A modern, fast and flexible .NET testing framework
exceptionless/Exceptionless
Exceptionless application
Nethereum/Nethereum
Ethereum .Net cross platform integration library
wiremock/WireMock.Net
WireMock.Net is a flexible product for stubbing and mocking web HTTP responses using advanced request matching and response templating. Based on WireMock Java, but extended and different functionality. Full documentation can be found at https://wiremock.org/dotnet/.
DuendeSoftware/products
The most flexible and standards-compliant OpenID Connect and OAuth 2.x framework for ASP.NET Core
bitfoundation/bitplatform
Build all of your apps using what you already know and love ❤️
microsoft/aspire-samples
Browse the sample apps demonstrating Aspire integration across C#, JavaScript, TypeScript, Python, Go, containers, databases, cloud, AI, and observability scenarios.
microsoft/testfx
This repository holds the source code of Microsoft.Testing.Platform (MTP), a lightweight alternative to VSTest, as well as MSTest adapter and framework.
CommunityToolkit/Aspire
A community project with additional components and extensions for Aspire
thangchung/practical-dotnet-aspire
The practical .NET Aspire builds on the coffeeshop app business domain
dotnet/systemweb-adapters
daohainam/microservice-patterns
Microservice pattern demos (Saga, EventSourcing, CQRS...) running on .NET Aspire
james-gould/azure-keyvault-emulator
An emulator for Azure Key Vault. Compatible with the Azure Client SDK, runnable with Docker or Aspire.
neozhu/cleanaspire
CleanAspire is a cloud-native template built on Aspire, using .NET 10 Minimal APIs and Blazor WebAssembly to deliver lightweight, scalable PWAs with offline support.
dotnet-presentations/aspire-workshop
This Aspire workshop will get you started building apps with Aspire!
netclaw-dev/netclaw
Simple, secure, reliable agents. Self-hosted. Open source. Built with .NET.
aws/integrations-on-dotnet-aspire-for-aws
This repository contains integrations with Aspire for AWS.
Version Downloads Last Updated
13.6.0 9,574 9/29/2026
13.5.4 148,084 9/15/2026
13.5.3 350,085 8/25/2026
13.5.2 52,556 8/21/2026
13.5.1 23,319 8/20/2026
13.5.0 44,449 8/18/2026
13.4.6 1,229,729 6/19/2026
13.4.5 82,169 6/17/2026
13.4.4 77,405 6/15/2026
13.4.3 205,925 6/8/2026
13.4.2 96,532 6/3/2026
13.4.1 7,566 6/3/2026
13.4.0 88,323 6/1/2026
13.3.5 240,502 5/21/2026
13.3.4 50,806 5/19/2026
13.3.3 86,826 5/15/2026
13.3.2 90,803 5/14/2026
13.3.1 29,179 5/12/2026
13.3.0 145,521 5/7/2026
13.2.4 361,309 4/24/2026
Loading failed