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 <223556219+Copilot@users.noreply.github.com>
@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

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

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.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@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 <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Karol Zadora-Przylecki <karolz@microsoft.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: karolz-ms <15271049+karolz-ms@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
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