Default AppHosts to use the CLI bundle#18188
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 18188Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 18188" |
There was a problem hiding this comment.
Pull request overview
This PR changes the default AppHost build behavior from per-RID DCP/dashboard NuGet package resolution to CLI bundle resolution by defaulting AspireUseCliBundle to true for C# AppHost projects. Users without an installed Aspire CLI will see ASPIRE009; users who explicitly opt out will see ASPIRE010.
Changes:
- Defaults
AspireUseCliBundle=truefor.csprojAppHosts in bothAspire.Hosting.AppHost.propsandSdk.in.targets, addsASPIRE010warning for explicit opt-out. - Expands CLI bundle MSBuild discovery in
ResolveAspireCliBundle.csto support versioned extraction roots, install-route sidecars,ASPIRE_HOMEenvironment variable fallback, and dotnet-tool shim/store layouts. - Updates tests to verify the new default behavior (skipping DCP package references, opt-out warning emission, ASPIRE_HOME resolution, dotnet-tool store resolution) and adjusts existing tests to explicitly opt out where needed.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/Aspire.Hosting.AppHost/build/Aspire.Hosting.AppHost.props | Defaults AspireUseCliBundle=true for .csproj AppHosts |
| src/Aspire.AppHost.Sdk/SDK/Sdk.in.targets | Same default for SDK-based AppHosts |
| src/Aspire.Hosting.AppHost/build/Aspire.Hosting.AppHost.in.targets | Adds ASPIRE010 warning target and updates ASPIRE009 error message |
| src/Aspire.Hosting.Tasks/ResolveAspireCliBundle.cs | Adds versioned bundles, install sidecars, ASPIRE_HOME, dotnet-tool store discovery |
| tests/Aspire.Hosting.Tests/MSBuildTests.cs | New tests for ASPIRE_HOME, dotnet-tool store, opt-out warning; env passthrough support |
| tests/Aspire.Hosting.Sdk.Tests/AppHostSdkTargetsTests.cs | Verifies default skips DCP packages; existing tests opt out explicitly |
| tests/Aspire.Hosting.Tests/Directory.Build.props | Opts out of CLI bundle for existing test project |
| docs/list-of-diagnostics.md | Documents ASPIRE009 and ASPIRE010 diagnostics |
Ensure Aspire CLI-launched AppHosts can resolve the current CLI bundle during MSBuild probes and builds, and opt template test builds out of bundle resolution. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
PR Testing ReportPR Information
Artifact Version Verification
Changes AnalyzedFiles Changed
Change Categories
Test Scenarios ExecutedScenario 1: Starter template bundle happy pathObjective: Create a fresh starter app from the PR hive and verify the generated C# AppHost builds with default CLI bundle behavior. Scenario 2: App run/dashboard startupObjective: Verify a starter app created from the PR hive starts through the PR CLI bundle and exposes running resources/dashboard state. Scenario 3: Empty template default bundle smokeObjective: Create a fresh empty app from the PR hive and verify the generated file-based AppHost starts with the PR CLI. Scenario 4: Explicit opt-out warningObjective: Verify explicit Scenario 5: Missing bundle errorObjective: Verify invalid explicit bundle path fails safely with Summary
Overall ResultPR VERIFIED Artifacts
Cleanup / Inspection Status
Recommendations
|
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
❓ CLI E2E Tests unknown — 114 passed, 0 failed, 3 unknown (commit View all recordings
📹 Recordings uploaded automatically from CI run #27448786188 |
| <!-- Aspire hosting projects aren't publishable right now until https://github.com/microsoft/aspire/issues/147 is good --> | ||
| <IsPublishable Condition="'$(IsPublishable)' == ''">false</IsPublishable> | ||
| <IsPackable Condition="'$(IsPackable)' == ''">false</IsPackable> | ||
| <AspireUseCliBundle Condition="'$(AspireUseCliBundle)' == '' and '$(MSBuildProjectExtension)' == '.csproj'">true</AspireUseCliBundle> |
There was a problem hiding this comment.
Why the extension check?
|
|
||
| <PropertyGroup> | ||
| <_AspireCliBundleNotFoundError>$(MSBuildProjectName) is configured with AspireUseCliBundle=true, but the Aspire CLI bundle could not be resolved. Install the Aspire CLI from https://get.aspire.dev and ensure the aspire command is available on PATH, or set AspireCliBundlePath/AspireCliPath to a valid Aspire CLI installation or bundle layout.</_AspireCliBundleNotFoundError> | ||
| <_AspireCliBundleNotFoundError>$(MSBuildProjectName) is configured to use the Aspire CLI bundle, but the bundle could not be resolved. Some new Aspire features require the Aspire CLI to be installed. Install the Aspire CLI from https://get.aspire.dev and ensure the aspire command is available on PATH, or set AspireCliBundlePath/AspireCliPath to a valid Aspire CLI installation or bundle layout.</_AspireCliBundleNotFoundError> |
There was a problem hiding this comment.
I think we want to be more assertive with the error message. The plan to deprecate the the existing nuget packages (we can name then) and move to the aspire cli instead of saying "some features".
Description
C# AppHosts now use the Aspire CLI bundle by default by setting
AspireUseCliBundletotruewhen the property is otherwise unspecified. This moves new/default AppHost builds to the bundled DCP/dashboard layout and avoids requiring users to explicitly opt in to the CLI bundle path.Fixes # (issue)
User-facing usage
AppHost projects no longer need to set
AspireUseCliBundle=trueto use the CLI bundle. If the bundle cannot be resolved, build reportsASPIRE009with install guidance and a link to https://get.aspire.dev.Users can still opt out explicitly:
Opting out emits
ASPIRE010because some Aspire features may not work without the CLI bundle. Users who intentionally opt out can suppress that warning by ID, for example withNoWarn.Breaking changes
This changes the default AppHost build behavior from per-RID DCP/dashboard NuGet package resolution to CLI bundle resolution. Users without an installed Aspire CLI may now see
ASPIRE009; install the Aspire CLI from https://get.aspire.dev or setAspireUseCliBundle=falseto keep using the previous package-based path.Implementation details
AspireUseCliBundletotruefor C# AppHost projects in both AppHost package props and SDK targets.ASPIRE010for explicit opt-out and updatesASPIRE009wording.bundle/, versioned extraction roots, install-route sidecars,ASPIRE_HOME, and dotnet-tool shim/store layouts.Validation
dotnet test --project tests\Aspire.Hosting.Sdk.Tests\Aspire.Hosting.Sdk.Tests.csproj --no-launch-profile -- --filter-class "*.AppHostSdkTargetsTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"dotnet test --project tests\Aspire.Hosting.Tests\Aspire.Hosting.Tests.csproj --no-launch-profile -- --filter-class "*.MSBuildTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"dotnet build src\Aspire.Hosting.Tasks\Aspire.Hosting.Tasks.csproj /p:SkipNativeBuild=trueaspire-starterunderD:\scratch, verifiedAspireUseCliBundledefaults totrue, verified normal build/run uses the local hive bundle/dashboard, verified opt-out emitsASPIRE010, and verified a missing CLI bundle fails withASPIRE009and install guidance.Checklist
<remarks />and<code />elements on your triple slash comments?