Repository navigation
[release/17.0] Remove redundant CLI bundle opt-ins from templates - #22226
Eric Erhardt (eerhardt) wants to merge 2 commits into
Conversation
Backport of #21986 Co-authored-by: Copilot App <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 -- 22226Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 22226" |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟡 Changes recommended
The updated test expectations and snapshot omit the compatibility directive still emitted by 17.0.0-pr.* CLI builds, causing mismatches in PR CI.
2 open issues
What changed in this PR
Backports #21986 to release/17.0, removing redundant CLI bundle opt-ins so current C# AppHosts use SDK defaults and respect inherited settings.
Changes:
- Removes explicit bundle settings from project templates, single-file templates, and
aspire init. - Preserves compatibility directives for versions before 17.0 and all 17.0.0 prereleases.
- Updates generation, SDK, and end-to-end tests, including coverage for inherited
AspireUseCliBundle=falseproducing ASPIRE013.
| File | Description |
|---|---|
| tests/Aspire.Hosting.Sdk.Tests/AppHostSdkTargetsTests.cs | Tests bundle defaults and inherited opt-outs. |
| tests/Aspire.Cli.Tests/Snapshots/InitCommandTests.InitCommand_FileBased_SkipsSolutionDiscovery.verified.txt | Removes the explicit bundle directive from expected output. |
| tests/Aspire.Cli.Tests/Commands/NewCommandTests.cs | Checks version-dependent generated directives. |
| tests/Aspire.Cli.Tests/Commands/InitCommandTests.cs | Adds version-dependent initialization expectations. |
| tests/Aspire.Cli.EndToEnd.Tests/SingleFileAppHostInitDotnetRunTests.cs | Updates generated-source checks and clears the inherited bundle setting. |
| tests/Aspire.Cli.EndToEnd.Tests/BundleSmokeTests.cs | Updates project and single-file bundle checks. |
| src/Aspire.ProjectTemplates/templates/aspire-ts-cs-starter/Aspire-StarterApplication.1.AppHost/Aspire-StarterApplication.1.AppHost.csproj | Removes the starter’s explicit bundle opt-in. |
| src/Aspire.ProjectTemplates/templates/aspire-starter/Aspire-StarterApplication.1.AppHost/Aspire-StarterApplication.1.AppHost.csproj | Removes the starter’s explicit bundle opt-in. |
| src/Aspire.ProjectTemplates/templates/aspire-empty/AspireApplication.1.AppHost/AspireApplication.1.AppHost.csproj | Removes the empty project’s explicit bundle opt-in. |
| src/Aspire.ProjectTemplates/templates/aspire-apphost/Aspire.AppHost1.csproj | Removes the AppHost project’s explicit bundle opt-in. |
| src/Aspire.ProjectTemplates/templates/aspire-apphost-singlefile/apphost.cs | Removes the single-file template’s bundle directive. |
| src/Aspire.Cli/Templating/Templates/empty-apphost/apphost.cs | Delegates bundle directives to version-aware generation. |
| src/Aspire.Cli/Templating/CliTemplateFactory.EmptyTemplate.cs | Retains explicit opt-ins only for compatibility versions. |
| src/Aspire.Cli/Commands/InitCommand.cs | Uses the shared directive generator without an unconditional opt-in. |
Review effort: Balanced
|
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. |
…erelease CLI identity - InitCommandTests: pin the file-based init test's execution context to a stable 17.0.0 identity so the snapshot doesn't depend on whether CI's assembly version happens to be a 17.0.0-pr.* prerelease (which would retain the AspireUseCliBundle=true compatibility directive). - BundleSmokeTests/SingleFileAppHostInitDotnetRunTests: compute the expected AppHost source using the installed CLI's actual version, adding the compatibility directive only when the version matches the same pre-17/17.0.0-prerelease rule used by GetCSharpAppHostDirectives. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Tests selector4 / 101 PR test projects · 6 PR jobs, from 15 changed files. Selected PR test projects (4 / 101)
Selected PR jobs (6)
How these were chosen — grouped by what changed🔧 🔧 🔧 🔧 🔧 📦 affected project 🧪 🧪 🧪 🧪 🧪 🧪 🧪 Job reasons
Selection computed for commit |

Backport of #21986 to release/17.0.
Description
Current C# AppHost SDKs enable the CLI bundle by default. Remove the redundant
AspireUseCliBundleopt-in from the project and single-file templates and fromaspire init. An explicitly inheritedAspireUseCliBundle=false(environment orDirectory.Build.props) now takes effect and the SDK reports ASPIRE013.The cherry-pick conflicted in
tests/Aspire.Hosting.Sdk.Tests/AppHostSdkTargetsTests.cs; theASPIRE015tests that exist only onmainwere not carried over.Validation
dotnet test --project tests/Aspire.Hosting.Sdk.Tests/Aspire.Hosting.Sdk.Tests.csproj --no-launch-profile -- --filter-method "*CliBundle*" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"(42 passed, 1 skipped).Checklist