liveBook · Manning

Migration

As explained in Building Distributed Applications that Work

Migration is the process of adapting an existing software system or project to another platform version or environment.

Migration adapts an existing Aspire application to a newer version without rebuilding its services. For an Aspire 8 application with a web frontend, API, and SQL Server integration, the practical route to Aspire 13 is to upgrade to Aspire 9 first, then use Aspire’s update tool. section 10.1.1

Upgrade in two stages:

  • From Aspire 8 to 9, edit the AppHost project file manually: add an `Aspire.AppHost.Sdk` element with a 9.x version and update the host, integration, and Aspire client packages to 9.x. Consider updating a .NET 8 solution to at least .NET 9. section 10.1.1
  • From Aspire 9 to 13, install the Aspire CLI, go to the solution, and run `aspire update`. It updates Aspire-related SDK and package references across the solution. A manual update to 13.x is also possible; use `aspire update --self` when the CLI itself needs updating. section 10.1.2
Listing 10.2 .NET Aspire 9 project definition
<Project Sdk="Microsoft.NET.Sdk">

  <Sdk Name="Aspire.AppHost.Sdk" Version="9.0.0" />   #1

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net9.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <IsAspireHost>true</IsAspireHost>
    <UserSecretsId>b6070f86-3ef8-4a16-bc70-cdeed5b2851f</UserSecretsId>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\AspireApp.ApiService\AspireApp.ApiService.csproj" />
    <ProjectReference Include="..\AspireApp.Web\AspireApp.Web.csproj" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Aspire.Hosting.AppHost" Version="9.2.1" />   #2
    <PackageReference Include="Aspire.Hosting.SqlServer" Version="9.2.1" /> #3
  </ItemGroup>

</Project>

Compare the Aspire 9 AppHost definition with the older project: the SDK element is present, and the host and SQL Server packages have moved to 9.x. section 10.1.1

An updated Aspire 13 project may retain the older, more verbose project-file structure. That is supported. To use the shorter format, put `Aspire.AppHost.Sdk/` and its version in the top-level `Project` SDK attribute, then remove the separate SDK element, `IsAspireHost`, and `Aspire.Hosting.AppHost` reference. This changes the project-file syntax, not its behavior. Startup and orchestration code may remain in `Program.cs` or `AppHost.cs`, but not both. section 10.1.2

Listing 10.4 Modernized Aspire 13 project format
<Project Sdk="Aspire.AppHost.Sdk/13.1.0">   #1

  <PropertyGroup>    #2
    <OutputType>Exe</OutputType>
    <TargetFramework>net10.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <UserSecretsId>2f2ef062-99af-422f-b6a5-1094759553e7</UserSecretsId>
  </PropertyGroup>
<ItemGroup>
    <ProjectReference Include="..\AspireApp.ApiService\AspireApp.ApiService.csproj" />
    <ProjectReference Include="..\AspireApp.Web\AspireApp.Web.csproj" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Aspire.Hosting.SqlServer" Version="13.3.5" /> #3
  </ItemGroup>

</Project>

Shows the shorter Aspire 13 AppHost definition after the optional project-file cleanup. section 10.1.2

How Building Distributed Applications that Work covers it

How deep it goes
Gives project-file edits and CLI commands for a staged upgrade; does not detail application-code changes.
Examples
Uses project definitions for a web frontend, API service, and SQL Server integration across Aspire 8, 9, and 13.
What it assumes
Assumes an existing .NET Aspire solution; supplies the required project-file changes and CLI command.
What you can do after
Operate/configure an Aspire 8-to-13 upgrade using manual edits followed by `aspire update`, with optional project-file cleanup.
How it connects
Connects migration to AppHost projects, SDK and package references, SQL Server integration, and startup files.

Also explained in

Compare how 19 books explain migration →

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.