Skip to content

[release/17.0] Report obsolete Aspire.AppHost.Sdk in aspire update --migrate - #22340

Merged
Jose Perez Rodriguez (joperezr) merged 3 commits into
release/17.0from
cli/migrate-aspire012-message
Nov 17, 2026
Merged

Jose Perez Rodriguez (joperezr) merged 3 commits into
release/17.0from
cli/migrate-aspire012-message

Conversation

@maddymontaquila

Copy link
Copy Markdown
Collaborator

Description

aspire update --migrate printed "Nothing to migrate. The current project is already using the latest recommended Aspire conventions." for C# AppHosts that still use Aspire.AppHost.Sdk, even though the next build emits ASPIRE012. Removing the SDK is intentionally approval-gated and is not applied automatically, so this PR only changes the message.

When no automatic migrations apply and the AppHost still declares Aspire.AppHost.Sdk, the CLI now prints:

No automatic migrations apply. This AppHost still uses Aspire.AppHost.Sdk (ASPIRE012), which is obsolete. See https://aka.ms/aspire/diagnostics/aspire012 for how to migrate.

Detection (DotNetAppHostProject.UsesObsoleteAppHostSdk) checks the AppHost file after the package update ran:

  • file-based apphost.cs: #:sdk Aspire.AppHost.Sdk[@version] in the directive preamble (reuses FallbackProjectParser)
  • project files: Sdk="Aspire.AppHost.Sdk[/version]" (incl. multi-SDK lists), <Sdk Name="Aspire.AppHost.Sdk" />, <Import Sdk="Aspire.AppHost.Sdk" />
  • respects suppression declared in the AppHost file itself (SuppressAspireAppHostSdkObsoleteWarning=true or NoWarn containing ASPIRE012, mirroring the check in Sdk.in.targets)

Plain aspire update (without --migrate) prints nothing when no migrations are pending, so it is unaffected.

The aka.ms link is the same HelpLink used by the ASPIRE012 warning; the docs page is being added in microsoft/aspire.dev#2180. Related: #22336.

Fixes #22335

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
    • No

When no automatic migrations apply but the AppHost still uses Aspire.AppHost.Sdk
(ASPIRE012), don't claim the project already follows the latest conventions.
Point users at the ASPIRE012 migration guidance instead.

Fixes #22335

Co-authored-by: Copilot App <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 22340

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 22340"

@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Suppression detection misses ASPIRE012 in non-final NoWarn entries and incorrectly treats inactive conditional properties as active, causing migration guidance to disagree with build warnings.

2 open issues
1 file not reviewed
  • src/Aspire.Cli/Resources/MigrationStrings.Designer.cs: Generated file
What changed in this PR

Updates aspire update --migrate to report obsolete Aspire.AppHost.Sdk usage instead of claiming the AppHost follows the latest conventions. SDK removal remains approval-gated and is not automated.

Changes:

  • Detects legacy SDK declarations and local warning suppressions in C# AppHost files.
  • Adds an ASPIRE012 advisory with migration guidance when no automatic migrations apply.
  • Adds detection and command-output tests, plus localization resource entries.
File Description
tests/​Aspire.Cli.Tests/​Projects/​DotNetAppHostProjectTests.cs Tests SDK detection and suppression handling.
tests/​Aspire.Cli.Tests/​Commands/​UpdateCommandTests.cs Tests migration advisory selection.
src/​Aspire.Cli/​Resources/​xlf/​MigrationStrings.zh-Hant.xlf Adds advisory entry for Traditional Chinese localization.
src/​Aspire.Cli/​Resources/​xlf/​MigrationStrings.zh-Hans.xlf Adds advisory entry for Simplified Chinese localization.
src/​Aspire.Cli/​Resources/​xlf/​MigrationStrings.tr.xlf Adds advisory entry for Turkish localization.
src/​Aspire.Cli/​Resources/​xlf/​MigrationStrings.ru.xlf Adds advisory entry for Russian localization.
src/​Aspire.Cli/​Resources/​xlf/​MigrationStrings.pt-BR.xlf Adds advisory entry for Brazilian Portuguese localization.
src/​Aspire.Cli/​Resources/​xlf/​MigrationStrings.pl.xlf Adds advisory entry for Polish localization.
src/​Aspire.Cli/​Resources/​xlf/​MigrationStrings.ko.xlf Adds advisory entry for Korean localization.
src/​Aspire.Cli/​Resources/​xlf/​MigrationStrings.ja.xlf Adds advisory entry for Japanese localization.
src/​Aspire.Cli/​Resources/​xlf/​MigrationStrings.it.xlf Adds advisory entry for Italian localization.
src/​Aspire.Cli/​Resources/​xlf/​MigrationStrings.fr.xlf Adds advisory entry for French localization.
src/​Aspire.Cli/​Resources/​xlf/​MigrationStrings.es.xlf Adds advisory entry for Spanish localization.
src/​Aspire.Cli/​Resources/​xlf/​MigrationStrings.de.xlf Adds advisory entry for German localization.
src/​Aspire.Cli/​Resources/​xlf/​MigrationStrings.cs.xlf Adds advisory entry for Czech localization.
src/​Aspire.Cli/​Resources/​MigrationStrings.resx Defines the advisory text and migration link.
src/​Aspire.Cli/​Resources/​MigrationStrings.Designer.cs Exposes the new resource string.
src/​Aspire.Cli/​Projects/​DotNetAppHostProject.cs Detects obsolete SDK declarations and local suppressions.
src/​Aspire.Cli/​Commands/​UpdateCommand.cs Selects the advisory when no migrations are pending.

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Warning-suppression detection mishandles whitespace-delimited NoWarn values and properties assigned in late-running targets, producing misleading migration messages.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

Medium severity Ignore unevaluated target assignments when detecting suppression

src/​Aspire.Cli/​Projects/​DotNetAppHostProject.cs:1410

root.Descendants() counts suppression assignments inside targets that have not executed. An unconditional SuppressAspireAppHostSdkObsoleteWarning=true inside a target with AfterTargets="Build" therefore restores the misleading “latest recommended conventions” message, even though ASPIRE012 runs before PrepareForBuild. Restrict suppression detection to evaluation-time project property groups and add a regression test for a late target assignment.

2 resolved since last review
1 file not reviewed
  • src/Aspire.Cli/Resources/MigrationStrings.Designer.cs: Generated file

Review effort: Balanced

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Tests selector

3 / 101 PR test projects · 4 PR jobs, from 19 changed files.

Selected PR test projects (3 / 101)

Aspire.Cli.EndToEnd.Tests, Aspire.Cli.Tests, Infrastructure.Tests

Selected PR jobs (4)

cli-starter-validation, extension-e2e, polyglot, typescript-api-compat


How these were chosen — grouped by what changed

📦 affected project Aspire.Cli
→ 1 test: Aspire.Cli.EndToEnd.Tests

🔧 src/Aspire.Cli/Resources/MigrationStrings.resx (changed source)
→ 1 directly: Infrastructure.Tests

🧪 tests/Aspire.Cli.Tests/Commands/UpdateCommandTests.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Projects/DotNetAppHostProjectTests.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

Job reasons

Job Triggered by
cli-starter-validation affected project Aspire.Cli
extension-e2e • src/Aspire.Cli/Commands/UpdateCommand.cs, src/Aspire.Cli/Projects/DotNetAppHostProject.cs, src/Aspire.Cli/Resources/MigrationStrings.Designer.cs, src/Aspire.Cli/Resources/MigrationStrings.resx, src/Aspire.Cli/Resources/xlf/MigrationStrings.cs.xlf, src/Aspire.Cli/Resources/xlf/MigrationStrings.de.xlf, src/Aspire.Cli/Resources/xlf/MigrationStrings.es.xlf, src/Aspire.Cli/Resources/xlf/MigrationStrings.fr.xlf, src/Aspire.Cli/Resources/xlf/MigrationStrings.it.xlf, src/Aspire.Cli/Resources/xlf/MigrationStrings.ja.xlf, src/Aspire.Cli/Resources/xlf/MigrationStrings.ko.xlf, src/Aspire.Cli/Resources/xlf/MigrationStrings.pl.xlf, src/Aspire.Cli/Resources/xlf/MigrationStrings.pt-BR.xlf, src/Aspire.Cli/Resources/xlf/MigrationStrings.ru.xlf, src/Aspire.Cli/Resources/xlf/MigrationStrings.tr.xlf, src/Aspire.Cli/Resources/xlf/MigrationStrings.zh-Hans.xlf, src/Aspire.Cli/Resources/xlf/MigrationStrings.zh-Hant.xlf
• affected project Aspire.Cli
polyglot affected project Aspire.Cli
typescript-api-compat affected project Aspire.Cli

Selection computed for commit 88c75b0.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Suppression detection ignores later property overrides, allowing --migrate to report current conventions while the build still emits ASPIRE012; assignment ordering and regression coverage need correction.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Honor later assignments when determining warning suppression

src/​Aspire.Cli/​Projects/​DotNetAppHostProject.cs:1410

Any() treats an earlier suppression as active even when a later unconditional assignment clears it, so --migrate can still report “latest recommended conventions” while the build emits ASPIRE012. For example, assigning NoWarn first to ASPIRE012 and then to NU1605, or setting SuppressAspireAppHostSdkObsoleteWarning to true and then false, triggers this mismatch. Honor assignment order while preserving $(NoWarn) append semantics, and add regression cases for both overwritten properties.

1 resolved since last review
1 file not reviewed
  • src/Aspire.Cli/Resources/MigrationStrings.Designer.cs: Generated file

Review effort: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@joperezr
Jose Perez Rodriguez (joperezr) merged commit 54a4769 into release/17.0 Nov 17, 2026
430 of 433 checks passed
@microsoft-github-policy-service microsoft-github-policy-service Bot modified the milestone: 17.0 Nov 17, 2026
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

✅ No documentation update needed.

excluded → base_branch_is_release, title_release_prefix. The PR is a backport ([release/17.0] title prefix, release base). Docs belong with the original forward PR. Triggered signals (advisory): cli_command_file_changed (UpdateCommand.cs), cli_resource_strings_changed (MigrationStrings.resx), pr_body_has_cli_flag_mention, pr_body_has_deprecation_marker.

David Pine (IEvangelist) pushed a commit to microsoft/aspire.dev that referenced this pull request Nov 17, 2026
…pire.AppHost.Sdk (#2180)

## Summary

<!-- Describe what this pull request changes and why. -->

Moves aspire.dev off the legacy
`AddProject`/`AddCSharpApp`/`ProjectResource` APIs onto Aspire 17's
`AddDotnetProject`/`DotnetProjectResource`, and removes the obsolete
`Aspire.AppHost.Sdk`. Tracked in #2179.

**New pages**
- [Migrate to the new
DotnetProjectResource](/integrations/dotnet/migrate-dotnet-project-resource/):
why to upgrade, the agent-skill option, path/launch-profile/type
changes, and removing the AppHost SDK.
- `ASPIRE012` diagnostic (`Aspire.AppHost.Sdk` is obsolete), with
sidebar and overview rows. The `aspire update --migrate` notice from
microsoft/aspire#22340 links to it.

**Evergreen rewrites**
- `dotnet-host` is now the main .NET page. It adds endpoint filtering,
coordinated builds/restore, multithreaded builds, and links to
file-based apps and launch profiles.
- `get-started/aspire-sdk` is now "C# AppHost project configuration".
- C# file-based apps and launch profiles now use `AddDotnetProject`.
- `project-resources` becomes a short "Legacy project resources"
reference, listed in the sidebar below the migration guide. Inbound
links now point to `dotnet-host`.

**Sample sweep (C#/TS/Go)**
- Converted `AddProject<Projects.X>`, `addProject`, and `AddCSharpApp`
across app-host, fundamentals, deployment, get-started, testing,
architecture, and integration pages. This includes Blazor hosting,
WPF/WinForms, and container files.
- Testing samples now use
`CreateResourceBuilder<DotnetProjectResource>`, matching the 17 starter
template.
- Short `:::note[Upgrading to Aspire 17?]` pointers are added only where
readers are likely on the old API.

**Japanese docs**
- Only code fences are converted. Prose is left for the translation
pipeline.

**Out of scope / tracked upstream**
- Historical release notes (except link anchors), Azure Functions
(`AddAzureFunctionsProject`, microsoft/aspire#21345), Blazor gateway
upstream (microsoft/aspire#20837), and MAUI (microsoft/aspire#21350).

Supersedes the ASPIRE012/AppHost SDK parts of #1880 (not its ASPIRE010
changes).

Relates to #2179, microsoft/aspire#22336, microsoft/aspire#22335, and
microsoft/aspire#22340.

**Merge note:** #2085 (ASPIRE014) and #2110 (ASPIRE015) add rows next to
ASPIRE012 in `reference.topics.ts` and `diagnostics/overview.mdx`. If
either merges first, keep both rows in numeric order (011–015).

## Third-party links and affiliations

<!--
List any third-party links added or changed by this pull request and
disclose any
material affiliation with the linked organizations, such as employment,
sponsorship, or ownership. Write "None" if this pull request doesn't add
or
change third-party links.
-->

None

## Validation

<!-- List the checks you ran or explain why validation isn't needed. -->

- `bun run test:unit:twoslash-blocks`: the only failures are the 2
pre-existing `asOptional` ones in
`fundamentals/external-parameters.mdx`. No new failures.
- `bun x vitest run tests/unit/seo-lengths.vitest.test.ts`: passed.
- Local `astro dev`: changed EN and ja pages return 200, and new anchors
resolve.
- Runtime-checked with the .NET 11 SDK: `AddDotnetProject` with
WPF/WinForms, C# Blazor (`AddDotnetProjectBlazorGateway`), and TS Blazor
AppHosts.
- `bun run build` was not run locally; left to CI.

---------

Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Karol Zadora-Przylecki <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: karolz-ms <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Damian Edwards (DamianEdwards) pushed a commit that referenced this pull request Nov 24, 2026
#22348)

<!-- copilot-assessment:v1 -->
### Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: `8848ddee8533bee493addca4155693c0a4d35ee8`

| Dimension | Assessment | Rationale |
|---|---|---|
| Change confidence | 8.5/10 | ↑ Native macOS archive and routing tests
passed 193/193; binary-xattr probe preserved log contents and restored
the environment.<br>↓ New-head hosted Linux/Windows execution and the
intermittent upload race remain unverified; [CI is
running](https://github.com/microsoft/aspire/actions/runs/45334663754).
|
| Diagnosis confidence | 9/10 | ↑ Reported uploader failure names the
changing dependency directory excluded by tar; native macOS baseline
reproduced synthesized hidden metadata entries.<br>↓ The original
installer/upload race was not reproduced end-to-end. |
| Evidence fit | 8/10 | ↑ The retained failure evidence matches the
starter job, upload step, and frontend/node_modules path addressed by
this archive boundary.<br>↓ The macOS metadata correction addresses
archive correctness, not proof of the original race's timing. |
<!-- /copilot-assessment -->

## Description

The macOS CLI starter validation job intermittently fails in "Upload
starter validation diagnostics":

```text
ENOENT: no such file or directory, stat '.../aspire-go-starter/AspireCliGoStarterSmoke/frontend/node_modules'
```

The starter's npm installer can still change `node_modules` after
`aspire stop` returns. The pinned uploader enumerates paths and then
stats each result; a disappearing entry fails the upload. Negative
upload globs remove results but still traverse excluded directories.

Archive the diagnostics with `tar --exclude=node_modules` before
uploading, rather than maintaining a recursive copier. Only the
completed `starter-validation.tar` is uploaded; failed creation removes
the partial archive and fails the step. All nonzero tar exits remain
errors, including files changing or disappearing outside excluded
directories. This is not an atomic filesystem snapshot.

The archive retains generated project sources/manifests and diagnostics
under the validation-root directory. It preserves the uploader's default
exclusion of hidden files/directories and records symbolic links without
following their targets. macOS filesystem metadata is omitted using the
existing `CreateLayout` approach, so synthesized AppleDouble entries
cannot bypass hidden-file exclusions. The uploader compresses the
uncompressed tar.

The tests invoke the existing `PowerShellCommand` harness directly,
retaining its timeout, output capture, and process cleanup. The
test-trigger map selects both starter validation and
`Infrastructure.Tests` for script-only changes.
`scratch-cli-platform-smoke.yml` uses the same reusable workflow.

Evidence:
https://github.com/microsoft/aspire/actions/runs/43968755832/job/133671867903
(PR #22340, macOS x64).

Validation:
- macOS 27.2.1 arm64, .NET SDK 11.0.100, PowerShell 7.6.6, BSD tar 3.5.3
/ libarchive 3.7.4:
`MSBUILDTERMINALLOGGER=false dotnet test --project
tests/Infrastructure.Tests/Infrastructure.Tests.csproj
--no-launch-profile -- --filter-class
'*.StageCliStarterValidationDiagnosticsTests' --filter-class
'*.TestTriggerMapTests' --filter-not-trait 'quarantined=true'
--filter-not-trait 'outerloop=true'`: **passed 193/193**, no skipped
tests, against the final source committed as the assessed revision.
- The native macOS baseline at
`014fc591cafcd2f5fca46cdb80451db718482759` failed two of the five
archive scenarios on unexpected `._validation` entries. The unchanged
assertions now pass; Linux-only infrastructure CI would not exercise
Apple's synthesized metadata.
- Tests cover retained file contents, nested dependencies, hidden
files/directories, paths containing spaces, dangling/directory links,
missing source and stale output, and tar exit codes 1/2 with partial
output.
- A native tar probe with an injected binary macOS xattr retained the
log, omitted the xattr and synthesized metadata files, and confirmed
that the script restores the caller's `COPYFILE_DISABLE`.
- `./restore.sh`: **passed**, zero warnings/errors. No package/feed
configuration or audit override was changed.

Current-head hosted execution and the intermittent production race
remain **unvalidated**. The [prior-head CI
run](https://github.com/microsoft/aspire/actions/runs/44020721715)
succeeded at attempt 2 with all six starter platform jobs successful; it
does not validate the assessed revision or establish first-attempt
reliability. Local Linux validation could not run because the Docker
daemon socket is absent.

Refs #22347. The `release/17.0` backport is pending human merge of this
main fix.

## Checklist

- Is this feature complete?
  - [x] Yes. Ready to ship.
  - [ ] No. Follow-up changes expected.
- Are you including unit tests for the changes and scenario tests if
relevant?
  - [x] Yes
  - [ ] No
- Did you add public API?
  - [ ] Yes
    - If yes, did you have an API Review for it?
      - [ ] Yes
      - [ ] No
- Did you add `<remarks />` and `<code />` elements on your triple slash
comments?
      - [ ] Yes
      - [ ] No
  - [x] No
- Does the change make any security assumptions or guarantees?
  - [ ] Yes
    - If yes, have you done a threat model and had a security review?
      - [ ] Yes
      - [ ] No
  - [x] No

<!-- cif issue:22347 -->

---------

Co-authored-by: radical <[email protected]>
Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants