An AI coding assistant can help bring an existing .NET solution into Aspire by inspecting its projects, proposing an AppHost model, and making changes in reviewable steps. It can automate tedious work, but its proposed code still needs developer verification. section 10.0 section 10.4.2
Configure the Aspire MCP server from the Aspire host project folder, choosing an assistant such as Claude Code, Codex, or Copilot CLI. Launch the assistant from the solution folder so it can work with the host and the projects being added. section 10.4.1 section 10.4.2
aspire mcp init
Run this command in the Aspire host project folder to begin configuring the MCP server for a coding assistant. section 10.4.1
The configured MCP server gives the assistant tools to inspect and work with the current Aspire setup:
- List hosted resources and run commands supported by those resources. section 10.4.1
- Read console logs, structured logs, and traces to investigate problems across operations. section 10.4.1
- Discover integration packages and their documentation, or select an AppHost when multiple hosts are present. section 10.4.1
Add an existing solution incrementally
First ask the assistant to inspect the solution and propose an AppHost model, dependencies, and implementation order. Review its plan, then request one runnable project at a time. A proposed API–SQL Server–web frontend setup may look plausible while omitting health-check endpoints and WaitFor() calls for dependent services. Check and correct such gaps before shipping; autonomous execution calls for guardrails such as tests and linting. section 10.4.2
Listing 10.8 Claude output proposing AppHost structure
Suggested AppHost.cs (initial sketch)
```csharp
var builder = DistributedApplication.CreateBuilder(args);
var sql = builder.AddSqlServer("sql").WithLifetime(ContainerLifetime.Persistent);
var sqldb = sql.AddDatabase("sqldb");
var apiService = builder.AddProject<Projects.OnlineShop_ApiService>("apiservice")
.WithReference(sqldb);
builder
.AddProject<Projects.OnlineShop_Web>("webfrontend")
.WithExternalHttpEndpoints()
.WithReference(apiService);
builder.Build().Run();
```
The proposed AppHost sketch shows the projects and SQL Server resource an assistant might connect; it is a starting point to review, not a verified final configuration. section 10.4.2
