liveBook · Manning

Ai coding assistant

As explained in Building Distributed Applications that Work

An AI coding assistant helps users create, modify, explain, or review source code.

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

How Building Distributed Applications that Work covers it

How deep it goes
Walks through MCP configuration, repository inspection, incremental prompts, and review; it does not treat generated plans as verified implementations.
Examples
Uses solution-inspection prompts, a proposed API–SQL Server–web AppHost, and an incremental implementation plan.
What it assumes
Assumes a .NET solution with an Aspire host and projects to update; gives the MCP setup step rather than assuming it is configured.
What you can do after
Apply it via an MCP-configured coding assistant to plan incremental Aspire changes and verify the resulting code.
How it connects
Connects coding assistants to Aspire AppHost, MCP, service dependencies, integrations, logs, traces, and health checks.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building Distributed Applications that Work. The section links point to the parts of the book it draws on.