Loading...
Loading...
Use when building distributed apps with Aspire; orchestrating .NET, JavaScript, Python, or polyglot services; when environment variables or service discovery aren't working; when migrating from .NET Aspire 9 to 13+ or Community Toolkit; when seeing AddNpmApp deprecated errors; when OTEL not appearing in dashboard; when ports change on restart breaking OAuth; when configuring MCP server for AI assistants; when debugging Aspire apps and need to check resource status or logs
npx skill4agent add mhagrelius/dotfiles working-with-aspire| Task | MCP Tool | NOT This |
|---|---|---|
| Check resource status | | ❌ curl to dashboard API |
| Get service logs | | ❌ curl, docker logs |
| View traces | | ❌ curl to OTLP endpoint |
| Find errors in traces | | ❌ manual dashboard search |
| List available AppHosts | | ❌ file system search |
aspire mcp init| Task | Reference File |
|---|---|
| AppHost patterns, resources, lifecycle | |
| Azure integrations (databases, messaging, AI) | |
| Database integrations (Postgres, SQL, Mongo) | |
| Caching (Redis, Valkey, Garnet) | |
| Messaging (Kafka, RabbitMQ, NATS) | |
| Polyglot (Node.js, Python, Go, Rust, Java) | |
| Deployment, CLI, and aspire do pipelines | |
| Testing with Aspire | |
| Errors and troubleshooting | |
| MCP integration for AI assistants | |
| VS Code extension | |
| Certificate trust configuration | |
| Migration from 9.x to 13.x | |
| Wrong | Correct | Why |
|---|---|---|
| | Method is just |
| | |
| | Use AddUvicornApp for ASGI (FastAPI, Starlette) |
| | Package renamed in 13.0 |
// WRONG - secrets exposed in source control
// appsettings.json: { "Parameters": { "api-key": "secret123" } }
// CORRECT - use user-secrets for development
// dotnet user-secrets set "Parameters:api-key" "secret123"aspire-13-migration.md// BEFORE (9.x) - REMOVED IN 13.0
builder.AddNpmApp("frontend", "../app", scriptName: "dev", args: ["--no-open"])
// AFTER (13.0) - Use AddJavaScriptApp or AddViteApp
builder.AddJavaScriptApp("frontend", "../app")
.WithRunScript("dev")
.WithArgs("--no-open");
// For Vite/React specifically:
builder.AddViteApp("frontend", "../app")
.WithHttpEndpoint(env: "PORT");
// Package renamed: Aspire.Hosting.NodeJs → Aspire.Hosting.JavaScript// BEFORE (13.0) - DEPRECATED
builder.AddAzureRedisEnterprise("cache")
// AFTER (13.1)
builder.AddAzureManagedRedis("cache")// BEFORE (9.x) - containerHostName parameter removed
await resource.ProcessArgumentValuesAsync(
executionContext, processValue, logger,
containerHostName: "localhost", cancellationToken);
// AFTER (13.0) - Use NetworkIdentifier
await resource.ProcessArgumentValuesAsync(
executionContext, processValue, logger, cancellationToken);
// Get endpoints with network context
var endpoint = api.GetEndpoint("http", KnownNetworkIdentifiers.DefaultAspireContainerNetwork);// BEFORE (9.x)
public class MyPublisher : IDistributedApplicationPublisher { }
// AFTER (13.0) - Use aspire do pipelines instead
// IDistributedApplicationPublisher is deprecated// Automatic - no configuration needed
var pythonApi = builder.AddUvicornApp("api", "./api", "main:app");
var nodeApi = builder.AddJavaScriptApp("frontend", "./frontend");
// Both automatically trust development certificates# Initialize MCP for Claude Code, GitHub Copilot, etc.
aspire mcp initaspire do build # Build container images
aspire do push # Push to registry
aspire do deploy # Full deployment
aspire do diagnostics # Show available stepsaspire init # Interactive setup
aspire init --single-file # Create .cs AppHost without .csproj// apphost.cs - no project file needed
#:package Aspire.Hosting@*
#:package Aspire.Hosting.Redis@*
var builder = DistributedApplication.CreateBuilder(args);
var cache = builder.AddRedis("cache");
builder.Build().Run();// Required packages:
// dotnet add package Aspire.Hosting.Python
// dotnet add package Aspire.Hosting.JavaScript (NOT NodeJs!)
// dotnet add package Aspire.Hosting.PostgreSQL
var builder = DistributedApplication.CreateBuilder(args);
// Database
var db = builder.AddPostgres("db")
.AddDatabase("appdata")
.WithDataVolume();
// FastAPI backend - use AddUvicornApp (NOT AddPythonApp!)
var api = builder.AddUvicornApp("api", "../api", "main:app")
.WithHttpEndpoint(port: 8000, env: "PORT")
.WithReference(db)
.WaitFor(db);
// React frontend - use AddViteApp (NOT AddNpmApp!)
builder.AddViteApp("frontend", "../frontend")
.WithHttpEndpoint(env: "PORT")
.WithExternalHttpEndpoints()
.WithReference(api);
builder.Build().Run();process.env.services__api__http__0var builder = DistributedApplication.CreateBuilder(args);
// Database
var db = builder.AddPostgres("db")
.AddDatabase("appdata")
.WithDataVolume();
// API with database reference
var api = builder.AddProject<Projects.Api>("api")
.WithReference(db)
.WaitFor(db);
// Frontend with API reference
builder.AddViteApp("frontend", "../frontend")
.WithHttpEndpoint(env: "PORT")
.WithReference(api);
builder.Build().Run();// Producer exposes endpoint
var api = builder.AddProject<Projects.Api>("api")
.WithHttpEndpoint(port: 5000, name: "api");
// Consumer references it (gets services__api__api__0 env var)
builder.AddProject<Projects.Web>("web")
.WithReference(api);var db = builder.AddPostgres("db");
var cache = builder.AddRedis("cache");
builder.AddProject<Projects.Api>("api")
.WithReference(db)
.WithReference(cache)
.WaitFor(db) // Wait for running
.WaitForHealthy(cache); // Wait for healthy (requires health check)app-host.mdazure-integrations.mdRunAsEmulator()RunAsContainer()polyglot-integrations.mddeployment-cli.mdaspire deployaspire publishaspire doaspire initmcp-integration.mdvs-code-extension.mdcertificate-config.mdaspire-13-migration.mddiagnostics.md