Skip to content

Commit f299dd1

Browse files
feat(aspire)!: upgrade to Aspire 17 and adopt Project v2 (#1689)
Upgrade the local-development AppHost to Aspire 17 using the CLI and adopt the new .NET project resource model. Production deployment remains on the existing Docker/CI pipeline. ## Changes - Align Aspire packages with 17.0.0 and pin the CLI version in `aspire.config.json`. - Replace the obsolete `Aspire.AppHost.Sdk` with `Microsoft.NET.Sdk` and explicit hosting packages. - Migrate Web registration and the journey fixture to `AddDotnetProject` / `DotnetProjectResource`, preserving database wiring and migration ordering. - Upgrade the dev-only Ollama integration to `17.0.0-beta.1052`. - Read the Copilot setup CLI version from `aspire.config.json`; document Mermaid resource graphs, Project v2 rebuilds, and Aspire 17's agent plugin setup. Keep the existing checked-in agent skills. ## Compatibility **BREAKING CHANGE:** The shared Hosting extensions now return and accept `IResourceBuilder<DotnetProjectResource>` instead of `IResourceBuilder<ProjectResource>`. Consuming aggregate AppHosts must reference `Aspire.Hosting.Dotnet` and update explicitly typed callers. Project v2 does not support `aspire run --watch`; use the documented resource rebuild workflow. The Ollama prerelease is intentional and limited to local development. ## Verification - AppHost/test project builds with zero warnings and errors. - All 28 AppHost tests pass, including Docker-backed smoke tests and browser journeys. - Isolated CLI startup reaches healthy Web and Ollama model resources; the existing `qwen2.5-coder:7b` model successfully generates a response. - Mermaid graph output works. The verification AppHost was stopped without deleting persistent volumes.
1 parent c85d2f7 commit f299dd1

9 files changed

Lines changed: 39 additions & 40 deletions

File tree

‎.github/workflows/copilot-setup-steps.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ jobs:
6868
timeout-minutes: 10
6969
shell: pwsh
7070
run: |
71-
[xml] $appHost = Get-Content dev/EssentialCSharp.Web.AppHost/EssentialCSharp.Web.AppHost.csproj
72-
$aspireVersion = $appHost.Project.Sdk.Version
71+
$aspireVersion = (Get-Content aspire.config.json -Raw | ConvertFrom-Json).sdk.version
72+
if (-not $aspireVersion) { throw "aspire.config.json does not define sdk.version." }
7373
$installer = "$env:RUNNER_TEMP/aspire-install.sh"
7474
Invoke-WebRequest https://aspire.dev/install.sh -OutFile $installer
7575
bash $installer --version $aspireVersion --install-path "$HOME/.aspire/bin" --skip-path

‎Directory.Packages.props‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@
1313
<PackageVersion Include="ContentFeedNuget" Version="$(ToolingPackagesVersion)" />
1414
</ItemGroup>
1515
<ItemGroup>
16-
<PackageVersion Include="Aspire.Hosting" Version="13.6.5" />
16+
<PackageVersion Include="Aspire.Hosting" Version="17.0.0" />
1717
<PackageVersion Include="Aspire.Hosting.AppHost" Version="17.0.0" />
18-
<PackageVersion Include="Aspire.Hosting.Testing" Version="13.6.5" />
19-
<PackageVersion Include="Aspire.Hosting.SqlServer" Version="13.6.5" />
20-
<PackageVersion Include="Aspire.Hosting.PostgreSQL" Version="13.6.5" />
21-
<PackageVersion Include="Aspire.Hosting.Browsers" Version="13.6.5-preview.1.26559.7" />
22-
<PackageVersion Include="Aspire.Hosting.EntityFrameworkCore" Version="13.6.5-preview.1.26559.7" />
23-
<PackageVersion Include="CommunityToolkit.Aspire.Hosting.Ollama" Version="13.6.1" />
18+
<PackageVersion Include="Aspire.Hosting.Dotnet" Version="17.0.0" />
19+
<PackageVersion Include="Aspire.Hosting.Testing" Version="17.0.0" />
20+
<PackageVersion Include="Aspire.Hosting.SqlServer" Version="17.0.0" />
21+
<PackageVersion Include="Aspire.Hosting.PostgreSQL" Version="17.0.0" />
22+
<PackageVersion Include="Aspire.Hosting.Browsers" Version="17.0.0-preview.1.26567.5" />
23+
<PackageVersion Include="Aspire.Hosting.EntityFrameworkCore" Version="17.0.0-preview.1.26567.5" />
24+
<PackageVersion Include="CommunityToolkit.Aspire.Hosting.Ollama" Version="17.0.0-beta.1052" />
2425
<PackageVersion Include="TUnit.Aspire" Version="1.77.0" />
2526
<PackageVersion Include="Azure.Extensions.AspNetCore.DataProtection.Keys" Version="1.6.5" />
2627
<PackageVersion Include="Microsoft.AspNetCore.DataProtection.EntityFrameworkCore" Version="10.0.15" />

‎EssentialCSharp.Web.Hosting/EssentialCSharp.Web.Hosting.csproj‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<ItemGroup>
77
<PackageReference Include="Aspire.Hosting" />
88
<PackageReference Include="Aspire.Hosting.Browsers" />
9+
<PackageReference Include="Aspire.Hosting.Dotnet" />
910
<PackageReference Include="Aspire.Hosting.EntityFrameworkCore" />
1011
<PackageReference Include="CommunityToolkit.Aspire.Hosting.Ollama" />
1112
</ItemGroup>

‎EssentialCSharp.Web.Hosting/WebHostingExtensions.cs‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Aspire.Hosting;
22
using Aspire.Hosting.ApplicationModel;
3+
using Aspire.Hosting.Dotnet;
34
using Microsoft.Extensions.Configuration;
45

56
namespace EssentialCSharp.Web.Hosting;
@@ -17,7 +18,7 @@ public static class WebHostingExtensions
1718
/// <param name="webDatabase">The existing SQL database connection resource.</param>
1819
/// <param name="vectorDatabase">The existing PostgreSQL database connection resource.</param>
1920
/// <returns>The Web resource, available for caller-specific configuration.</returns>
20-
public static IResourceBuilder<ProjectResource> AddEssentialCSharpWeb(
21+
public static IResourceBuilder<DotnetProjectResource> AddEssentialCSharpWeb(
2122
this IDistributedApplicationBuilder builder,
2223
string webProjectPath,
2324
IResourceBuilder<IResourceWithConnectionString> webDatabase,
@@ -43,7 +44,8 @@ public static IResourceBuilder<ProjectResource> AddEssentialCSharpWeb(
4344
"and set the AccessToNugetFeed environment variable to true before building and starting Aspire.");
4445
}
4546

46-
var web = builder.AddProject("essentialcsharp-web", webProjectPath, launchProfileName: null)
47+
var web = builder.AddDotnetProject(
48+
"essentialcsharp-web", webProjectPath, options => options.ExcludeLaunchProfile = true)
4749
.WithReference(webDatabase, connectionName: "EssentialCSharpWebContextConnection")
4850
.WithReference(vectorDatabase, connectionName: "PostgresVectorStore")
4951
.WaitFor(webDatabase)
@@ -77,8 +79,8 @@ public static IResourceBuilder<ProjectResource> AddEssentialCSharpWeb(
7779
}
7880

7981
/// <summary>Applies local AI policy; AppHost Azure/Foundry configuration takes precedence over Ollama.</summary>
80-
public static IResourceBuilder<ProjectResource> WithEssentialCSharpLocalAI(
81-
this IResourceBuilder<ProjectResource> web)
82+
public static IResourceBuilder<DotnetProjectResource> WithEssentialCSharpLocalAI(
83+
this IResourceBuilder<DotnetProjectResource> web)
8284
{
8385
ArgumentNullException.ThrowIfNull(web);
8486
var builder = web.ApplicationBuilder;
@@ -134,7 +136,7 @@ public static IResourceBuilder<ProjectResource> WithEssentialCSharpLocalAI(
134136
// environment (including connection strings) once Web starts after migration completion. Give only the
135137
// resources created by AddEFMigrations equivalent but independent annotations.
136138
private static void IsolateSharedEnvironmentCallbacks(
137-
ProjectResource web, IEnumerable<IResource> migrationResources)
139+
DotnetProjectResource web, IEnumerable<IResource> migrationResources)
138140
{
139141
var webCallbacks = web.Annotations.OfType<EnvironmentCallbackAnnotation>()
140142
.ToHashSet(ReferenceEqualityComparer.Instance);

‎README.md‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ For information on setting up your local development environment, please see the
1313
### Standalone Aspire development
1414

1515
Only this repository is required. Install the .NET SDK selected by `global.json`, Node.js/npm,
16-
the [Aspire CLI](https://aspire.dev/get-started/install-cli/), and a Docker-compatible container runtime.
16+
the [Aspire CLI](https://aspire.dev/get-started/install-cli/) version pinned by `sdk.version` in
17+
`aspire.config.json` (`aspire update --self` upgrades an existing install), and a Docker-compatible container runtime.
1718
Start the container runtime first. The single root solution includes the application, hosting
1819
library, AppHost, and all tests. The production Dockerfile restores, builds, and publishes only
1920
the Web project and its dependencies, without loading the Aspire projects.
@@ -31,6 +32,11 @@ and optional Ollama use persistent data volumes; restart with the same command t
3132
The AppHost has its own `UserSecretsId`, separate from ordinary Web application secrets.
3233
SQL Server passwords are generated by Aspire unless an AppHost `Parameters:sqlserver-password`
3334
secret is supplied. Stop only this AppHost using `aspire stop --apphost` with the same project path.
35+
Add `--format mermaid` to `aspire describe` to print the resource dependency graph as a Mermaid diagram.
36+
37+
The Web resource uses Aspire's Project v2 model (`AddDotnetProject`), which the AppHost builds
38+
before launch. Aspire watch [is not yet implemented for Project v2 resources](https://aspire.dev/integrations/dotnet/migrate-dotnet-project-resource/#check-workflows-before-migrating);
39+
after changing Web code, rebuild just that resource with `aspire resource essentialcsharp-web rebuild --apphost <path>`.
3440

3541
Local AI defaults to Ollama (`qwen2.5-coder:7b`, approximately 5 GB download); local vector search
3642
is not enabled. Disable model downloads before starting when chat is unnecessary:

‎aspire.config.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
"appHost": {
33
"path": "dev/EssentialCSharp.Web.AppHost/EssentialCSharp.Web.AppHost.csproj"
4+
},
5+
"sdk": {
6+
"version": "17.0.0"
47
}
58
}

‎dev/EssentialCSharp.Web.AppHost.Tests/Journeys/JourneyFixture.cs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Aspire.Hosting;
22
using Aspire.Hosting.ApplicationModel;
3+
using Aspire.Hosting.Dotnet;
34
using Aspire.Hosting.Testing;
45
using EssentialCSharp.Web.Areas.Identity.Data;
56
using EssentialCSharp.Web.Data;
@@ -41,7 +42,7 @@ protected override void ConfigureBuilder(IDistributedApplicationTestingBuilder b
4142
{
4243
base.ConfigureBuilder(builder);
4344

44-
ProjectResource web = builder.Resources.OfType<ProjectResource>().Single(resource => resource.Name == WebResource);
45+
DotnetProjectResource web = builder.Resources.OfType<DotnetProjectResource>().Single(resource => resource.Name == WebResource);
4546
Uri chatModelEndpoint = ChatModel.Endpoint;
4647
Uri hCaptchaApi = HCaptcha.ApiBaseUrl;
4748

‎dev/EssentialCSharp.Web.AppHost/EssentialCSharp.Web.AppHost.csproj‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
<Sdk Name="Aspire.AppHost.Sdk" Version="13.6.5" />
32
<PropertyGroup>
43
<TargetFramework>net10.0</TargetFramework>
54
<OutputType>Exe</OutputType>
@@ -10,10 +9,13 @@
109
</PropertyGroup>
1110
<ItemGroup>
1211
<PackageReference Include="Aspire.Hosting.AppHost" />
12+
<PackageReference Include="Aspire.Hosting.Dotnet" />
1313
<PackageReference Include="Aspire.Hosting.SqlServer" />
1414
<PackageReference Include="Aspire.Hosting.PostgreSQL" />
1515
<!-- Building the AppHost restores and builds Web before EF's no-build startup update. -->
16-
<ProjectReference Include="..\..\EssentialCSharp.Web\EssentialCSharp.Web.csproj" />
16+
<ProjectReference Include="..\..\EssentialCSharp.Web\EssentialCSharp.Web.csproj"
17+
IsAspireProjectResource="true"
18+
ReferenceOutputAssembly="false" />
1719
<ProjectReference Include="..\..\EssentialCSharp.Web.Hosting\EssentialCSharp.Web.Hosting.csproj"
1820
IsAspireProjectResource="false" />
1921
</ItemGroup>

‎docs/coding-agents.md‎

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,17 @@ The standalone `run-tests` skill is intentionally not vendored: it refers to `fi
1919
`.github/workflows/copilot-setup-steps.yml` prepares the cloud agent environment and is also
2020
used by Copilot code review while no separate `copilot-code-review.yml` workflow exists.
2121
Setup uses the [official Aspire install script](https://aspire.dev/get-started/install-cli/)
22-
to install the CLI bundle matching the AppHost SDK before building,
22+
to install the CLI bundle matching `sdk.version` in `aspire.config.json` before building,
2323
with a dedicated timeout and logs rather than relying on MSBuild's automatic bundle bootstrap.
2424
After building, setup installs Playwright Chromium and its Linux dependencies using the
2525
AppHost test project's generated script before running the .NET suite, including browser journeys.
2626

2727
### Aspire agent setup
2828

29-
The Aspire bundle was generated with Aspire CLI 13.6.4 using `aspire agent init`, not hand-written.
30-
The `aspire` router routes to companion skills, so keep the installed skills and their reference
31-
files together. Refresh both repository-local copies from the repository root:
32-
33-
```powershell
34-
aspire agent init --non-interactive --workspace-root . `
35-
--skill-locations standard,claudecode `
36-
--skills aspire,aspireify,aspire-orchestration,aspire-monitoring,aspire-deployment `
37-
--mcp=false
38-
```
39-
40-
`aspire-init` (first-run scaffolding) and `aspire-project-v2-migration` (one-time `ProjectResource`
41-
to `DotnetProjectResource` migration) are intentionally omitted: this repository already has an
42-
AppHost, and Project v2 is not adopted. The router still names them; reinstall with
43-
`aspire agent init --skills <name>` only if that work is actually planned.
44-
45-
The explicit skill list excludes optional companion tools such as `playwright-cli` and
46-
`dotnet-inspect`. `--mcp=false` leaves existing MCP configuration unchanged; these skills use
47-
the Aspire CLI without requiring an MCP server. The installer also refreshes user-level
48-
`~/.agents/skills` and installs agent usage telemetry hooks by default. Set
49-
`ASPIRE_CLI_TELEMETRY_OPTOUT=true` to opt out of telemetry.
29+
Keep the checked-in Aspire skills and their reference files together, including both repository
30+
copies under `.agents/skills/` and `.claude/skills/`. Use `aspire agent init` only when intentionally
31+
changing agent setup: its behavior is CLI-version-dependent and may change skill copies or plugin
32+
configuration. Review its current options and the resulting diff before applying changes.
5033

5134
Installing guidance does not execute or approve its workflows. This repository's AppHost is
5235
for **local development only**. Production continues through the existing Docker/CI pipeline,

0 commit comments

Comments
 (0)