Overview

10 Adding legacy apps to Aspire and working with AI agents

This chapter explains how to bring older Aspire-based systems forward to Aspire 13 and how to bring non-Aspire applications under Aspire orchestration. It starts from the reality that many production systems still run on Aspire 8 or 9, then shows that upgrading is straightforward: version 9 can be updated with the aspire update command, while version 8 requires a manual migration path through Aspire 9 before moving on to 13. Along the way, it highlights how Aspire has evolved into an evergreen platform that now supports more than just .NET.

Beyond version upgrades, the chapter walks through “aspirifying” an existing distributed application by adding an Aspire host, wiring in existing projects, and introducing service defaults for health checks, telemetry, and service discovery. It shows how to incorporate infrastructure components like SQL Server without disrupting production behavior, including the option to run a local container in development while still pointing to an external production database in release environments. The key idea is to preserve what already works while using Aspire to make local development, orchestration, and dependency management simpler and more reliable.

The chapter then turns to AI coding agents and explains how Aspire can cooperate with them through MCP. Agentic tool calling lets assistants inspect a codebase, query logs, discover integrations, and make changes using live context instead of guessing from stale assumptions. Aspire’s MCP setup exposes tools for resources, logs, traces, and integrations, enabling assistants like Claude Code to propose an AppHost model, plan incremental changes, and help implement them safely. The overall message is that Aspire plus AI agents can reduce repetitive migration work, but developers should still verify every change before shipping.

A system without Aspire orchestration
figure
The topology of our system after the Aspire orchestrator is added
figure
Complete aspirified system with intact production database connection
figure
Data flow between the agent and the MCP server
figure

Summary

  • You can upgrade Aspire from versions 8 and 9 to the evergreen version 13 manually by updating the SDK and packages or via the aspire CLI tool.
  • Aspirification is the process of adding non-Aspire applications to Aspire. Aspirification is done by adding the Aspire host and service defaults and then integrating both projects with the existing projects.
  • The Service Defaults package doesn’t have to be added to the aspirified system, but it helps because it comes with health checks and metrics.
  • The existing connection strings can be left intact for aspirified applications so they still work with the existing production resources.
  • Aspire can integrate with AI-based coding assistants via MCP and tool calling.

FAQ

What is the recommended way to upgrade a .NET Aspire 8 project to Aspire 13?

Aspire 8 projects must be upgraded manually first to Aspire 9, because the aspire update command does not work directly from Aspire 8 to 13. After moving to Aspire 9, you can then use the built-in upgrade tools or update the project manually to Aspire 13.

How do you migrate a .NET Aspire 8 host project to Aspire 9?

Add <Sdk Name="Aspire.AppHost.Sdk" Version="9.0.0" /> to the project file, update Aspire-specific packages to version 9, and move or keep the orchestration code in Program.cs or AppHost.cs. The project can still use the same general Aspire host pattern.

What command upgrades an Aspire 9 solution to Aspire 13 automatically?

Run aspire update in the solution folder. It updates the Aspire SDK, host package, and related client packages across the solution. If the CLI itself needs updating, use aspire update --self.

What changes are typically made to modernize an Aspire 13 project file after an upgrade?

You can simplify the project file by removing IsAspireHost, removing the explicit Aspire.AppHost.Sdk package-style entry, and removing the Aspire.Hosting.AppHost package reference. The top-level Project SDK becomes Aspire.AppHost.Sdk/<version>.

What is “aspirification”?

Aspirification is the process of enrolling an existing application into Aspire orchestration. It means taking an app that already exists and wiring it into an Aspire host so that Aspire can manage its startup, dependencies, observability, and local development experience.

How do you add an existing .NET application to Aspire orchestration?

You can either add the Aspire Host and Service Defaults projects manually in an IDE, or run aspire init in the solution folder. Then add project references in AppHost.cs, configure service defaults, and connect services with Aspire references and health checks.

How do you make existing services use Aspire service defaults?

Add builder.AddServiceDefaults(); in the service startup code, and then add app.MapDefaultEndpoints(); in the request pipeline. This enables shared service-discovery, telemetry, and health-check behavior.

How can an existing SQL Server-backed application be moved into Aspire without breaking production?

In the Aspire host, add a SQL Server resource and database for local development, then reference that database from the API. For production, use builder.AddConnectionString("sqldb") instead of a local container so the app still connects to the existing external database.

What is the difference between using Aspire integration libraries and using existing connection-string configuration?

The Aspire integration library approach is cleaner and shorter, such as builder.AddSqlServerDbContext<ProductsDbContext>("sqldb"). The minimal approach keeps the existing EF Core configuration and just changes the connection string name to match the Aspire-provided resource.

How does Aspire integrate with AI coding agents like Claude Code?

Aspire provides an MCP server that exposes tools and context to the agent. After running aspire mcp init, agents can inspect resources, read logs, list integrations, query traces, and get documentation so they can make accurate code changes and help modernize the solution safely.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


Close
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Building Distributed Applications that Work Building Distributed Applications that Work ebook for free
Close
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Building Distributed Applications that Work Building Distributed Applications that Work ebook for free
Close
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Building Distributed Applications that Work Building Distributed Applications that Work ebook for free