AspireExtensionsResource 130.2025.1121.547

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

AspireExtensionsResource

NuGet Version

This package provides Aspire as a Resource in the Aspire Host Dashboard , making it easier to test and manage Aspire dashboards. You can download the solution at https://github.com/ignatandrei/aspireExtensions/tree/main/src/AspireResourceExtensions in order to see the tests

Features

  • Adds Aspire dashboard as a resource for testings
  • Exposes login and base URLs as environment variables
  • Exposes Resources as Mermaid graph
  • Exposes Resources as CSV
  • Exposes Resources as Swagger API

( see Examples below )

Installation

Install via NuGet:

dotnet add package AspireExtensionsResource

Usage

  1. Add the Aspire resource to your distributed application builder:
using AspireResourceExtensionsAspire;

var aspire = builder.AddAspireResource();
  1. Use the resource to add environment variables to other resources:
aspire.Resource.AddEnvironmentVariablesTo(otherResource);

( see below integration with Playwright tests for .NET and NodeJS )

  1. Start parsing Aspire dashboard URLs:

Instead of

builder.Build().Run();

write this:

var result = aspire.Resource.StartParsing(app);
await Task.WhenAll(app.RunAsync(), result);

Integrations

Playwright NodeJS

Suppose that you have a NodeJS playwright app that you want to test your ASPIRE dashboard. You can integrate this way : In AppHost.cs


var npmTests = builder.AddNpmApp("GenerateVideo", "../GenerateTest")
    .WaitFor(aspire)
    .WithExplicitStart()
    ;

aspire.Resource.AddEnvironmentVariablesTo(tests,npmTests);

In the test you can write


const DEFAULT_BASE_URL = process.env.ASPIRE_BASE_URL ??"";
const DEFAULT_LOGIN_URL = process.env.ASPIRE_LOGIN_URL??""; 
const RESOURCE_URL = `${DEFAULT_BASE_URL}`;

test.describe('Test group', () => {
  test.use({ ignoreHTTPSErrors: true });

  test.beforeEach(async ({ page }) => {
    await page.goto(DEFAULT_LOGIN_URL);
    await page.waitForLoadState('networkidle');
  
  });

Playwright .NET

Suppose that you have a NodeJS playwright app that you want to test your ASPIRE dashboard. You can integrate this way:

In AppHost.cs

var tests= builder.AddTestProject<Projects.AspireResourceExtensions_Tests>("MyTests",
    "test --filter Category=Integration"
    )
    .WaitFor(aspire)
    .WithExplicitStart()
    ;
aspire.Resource.AddEnvironmentVariablesTo(tests);

In the Playwright test you will obtain the ASPIRE Dashboard url:


private (string ASPIRE_LOGIN_URL, string ASPIRE_BASE_URL) Endpoints = (
    Environment.GetEnvironmentVariable("ASPIRE_LOGIN_URL") ?? throw new ArgumentException("Should run from aspire")
    ,
    Environment.GetEnvironmentVariable("ASPIRE_BASE_URL") ?? throw new ArgumentException("Should run from aspire")
);

Examples

Screenshot of ASPIRE graph

Test code to obtain the screenshot of aspire

    var (loginUrl, baseUrl) = Endpoints; //see above definition of Endpoints
    playwright = await Playwright.CreateAsync();
    browser = await playwright.Chromium.LaunchAsync(new BrowserTypeLaunchOptions { Headless = false });
    page = await browser.NewPageAsync();
    await page.GotoAsync(loginUrl);
    await page.WaitForLoadStateAsync(LoadState.NetworkIdle);
    await page.GotoAsync(baseUrl);
    await page.WaitForLoadStateAsync(LoadState.NetworkIdle);    
    await page.GetByRole(AriaRole.Tab,new() { Name = "Graph" ,Exact=false} ).ClickAsync();
    await Task.Delay(5000);
    await page.GetByRole(AriaRole.Button, new() { Name = "Zoom Out", Exact = false }).ClickAsync();
    await Task.Delay(5000);
    await page.ScreenshotAsync(new PageScreenshotOptions { Path = "AspireResourceGraph.png" });

}

This is the result

Graph

Video of Aspire Dashboard

const actionsButton = page.getByRole('button', { name: 'Actions' }).nth(1);
    await flashAndClick(actionsButton);
    await flashAndClick(page.getByRole('menuitem', { name: 'View details' }));
    const urlTables = page.locator('table');
    await expect(urlTables).toHaveCount(7);

    const urlTable = urlTables.nth(2); // Assuming the URLs table is the second table on the page
    urlTable.scrollIntoViewIfNeeded();
    await flashAndClick(urlTable);
    const rows = urlTable.locator('tbody tr');
    await expect(rows).toHaveCount(2);

    // First row assertions
    const firstRow = rows.nth(0);
    await expect(firstRow.locator('a', { hasText: `${DEFAULT_BASE_URL}` })).toBeVisible();
    await expect(firstRow).toContainText('BaseUrl');
    await expect(firstRow).toContainText('ASPIRE_BASE_URL');
    await firstRow.highlight();
    // Second row assertions
    const secondRow = rows.nth(1);
    await expect(secondRow.locator('a', { hasText: `${DEFAULT_LOGIN_URL}` })).toBeVisible();
    await expect(secondRow).toContainText('LoginUrl');
    await expect(secondRow).toContainText('ASPIRE_LOGIN_URL');
    await secondRow.highlight();

And this is the video generated

https://ignatandrei.github.io/aspireExtensions/images/AspireResourceExtensions/ShowUrl.gif

ShowUrl

Mermaid graph of Aspire Resources

You can browse to http://localhost:(aspirePort+1)/mermaid.html to see the mermaid graph of the Aspire resources.

See the video generated

https://ignatandrei.github.io/aspireExtensions/images/AspireResourceExtensions/Mermaid.mp4

ShowUrl

Swagger API of Aspire Resources

You can browse to http://localhost:(aspirePort+1)/openapi/v1/swagger to see the swagger API of the Aspire resources. See the video generated

https://ignatandrei.github.io/aspireExtensions/images/AspireResourceExtensions/Swagger.mp4

ShowUrl

License

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

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

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
130.2025.1121.547 399 11/21/2025
95.2025.1030.2019 200 10/30/2025