Repository navigation
Obsolete AddCSharpApp in favor of AddDotnetProject - #20825
Conversation
Remove ASPIRECSHARPAPPS001 from the public overloads and polyglot dispatcher without changing API signatures or runtime behavior. Remove obsolete suppressions and update related documentation and generated TypeScript snapshot metadata. 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 -- 20825Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 20825" |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟢 Approval recommended
The narrowly scoped graduation is consistent across source, consumers, documentation, and generated TypeScript output.
0 open findings
What changed in this PR
Graduates AddCSharpApp by removing its experimental diagnostic while preserving existing behavior and API signatures.
Changes:
- Removes experimental attributes and related warning suppressions.
- Regenerates the TypeScript snapshot without
@experimental. - Updates related planning documentation.
| File | Description |
|---|---|
src/Aspire.Hosting/ProjectResourceBuilderExtensions.cs |
Removes experimental attributes from C# app APIs. |
src/Aspire.Hosting.Blazor/BlazorGatewayExtensions.cs |
Removes obsolete warning suppression. |
tests/Aspire.Hosting.Tests/Publishing/ResourceContainerImageManagerTests.cs |
Removes obsolete warning suppression. |
tests/Aspire.Hosting.Tests/ProjectResourceTests.cs |
Removes obsolete warning suppression. |
tests/Aspire.Hosting.Tests/DebugSupportExtensionsTests.cs |
Removes obsolete warning suppression. |
tests/Aspire.Hosting.Dotnet.Tests/DotnetProjectResourceTests.cs |
Removes obsolete warning suppression. |
tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.ts |
Records graduated TypeScript APIs. |
playground/Terminals/Terminals.AppHost/AppHost.cs |
Retains only the terminal diagnostic suppression. |
playground/FileBasedApps/Directory.Build.props |
Removes the C# app diagnostic suppression. |
docs/plans/project-v2-csharpprogram-watch.md |
Describes AddCSharpApp as stable. |
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Mark both public overloads and the polyglot dispatcher obsolete rather than experimental, retaining their implementations for compatibility. Point consumers to Aspire.Hosting.Dotnet, document migration, and cover warning-level obsoletion and polyglot deprecation metadata. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
Distinguish preserved legacy signatures and runtime behavior from changed deprecation metadata in the goal, consumer guidance, work breakdown, and polyglot risks. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Tests selector50 / 98 PR test projects · 4 PR jobs, from 11 changed files. Selected PR test projects (50 / 98)
Selected PR jobs (4)
How these were chosen — grouped by what changed
🔧 show 43
🔧 🧪 📦 affected project 📄 📄 📄 🧪 🧪 🧪 🧪 🧪 Job reasons
Selection computed for commit |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Documents the breaking change from microsoft/aspire#20825: AddCSharpApp (and the polyglot addCSharpApp export) is now marked [Obsolete] instead of [Experimental("ASPIRECSHARPAPPS001")], producing CS0618 instead of the experimental diagnostic. Adds migration guidance pointing consumers to AddDotnetProject from the Aspire.Hosting.Dotnet package. - Added a breaking-change entry to What's new in Aspire 17.0 - Added a Migrating to AddDotnetProject section to the C# file-based apps integration page, with updated Aside/limitations text - Updated the ASPIRECSHARPAPPS001 diagnostic page and the diagnostics overview table to note the obsoletion - Cross-referenced the migration guidance from the .NET host page, project-resources comparison, and the existing-app onboarding guide Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Pull request created: #1853
|
|
📝 Documentation has been drafted in microsoft/aspire.dev#1853 targeting Documents the
Note This draft PR needs human review before merging. |

Description
AddCSharpApphas always been experimental. ReplaceASPIRECSHARPAPPS001with warning-level[Obsolete]attributes directing consumers toAddDotnetProjectfromAspire.Hosting.Dotnet.Both public overloads and the internal
addCSharpAppdispatcher are obsolete. The dispatcher directs polyglot callers toaddDotnetProject; the TypeScript snapshot now emits@deprecatedrather than@experimental. Keep all signatures, return types, defaults, validation, callbacks, path/file/project/directory handling, launch/publish behavior, ATS exports, and export-ignore attributes unchanged.Remove the old diagnostic suppressions and narrowly suppress CS0618 at retained legacy compatibility consumers in production, playground, and tests. Add regression coverage for warning-level obsoletion, absence of experimental attributes, and ATS deprecation metadata with legacy options/exports preserved. Update XML documentation, the .NET integration's migration guidance, and the related design document. Generated
*/api/*.csbaselines remain untouched. No other API family is graduated or obsoleted.Breaking changes
Existing C#
AddCSharpAppcalls now produce CS0618 instead of the experimental diagnostic. Consumers treating warnings as errors must migrate or explicitly suppress the obsolete warning while retaining the legacy behavior.Add the
Aspire.Hosting.Dotnetintegration and useAddDotnetProject/addDotnetProject. It accepts the same kinds of paths, but returnsDotnetProjectResourcerather thanProjectResource/CSharpAppResource; explicitly typed builders and project-specific customizations may need updating. This PR does not automatically migrate or change the runtime behavior of existing consumers.User-facing usage
C# AppHost:
TypeScript AppHost:
Validation
Latest obsoletion commit: commands executed from the repository root. MTP commands exclude quarantined and outerloop tests.
./restore.shMSBUILDTERMINALLOGGER=false dotnet test --project tests/Aspire.Hosting.Tests/Aspire.Hosting.Tests.csproj --no-launch-profile -- --filter-class '*.ProjectResourceTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'MSBUILDTERMINALLOGGER=false dotnet test --project tests/Aspire.Hosting.Tests/Aspire.Hosting.Tests.csproj --no-launch-profile -- --filter-class '*.DebugSupportExtensionsTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'MSBUILDTERMINALLOGGER=false dotnet test --project tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.csproj --no-launch-profile -- --filter-class '*.AtsTypeScriptCodeGeneratorTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'MSBUILDTERMINALLOGGER=false dotnet build src/Aspire.Hosting.Blazor/Aspire.Hosting.Blazor.csproj --no-restore -v:qMSBUILDTERMINALLOGGER=false dotnet build playground/Terminals/Terminals.AppHost/Terminals.AppHost.csproj --no-restore -v:qMSBUILDTERMINALLOGGER=false dotnet build tests/Aspire.Hosting.Dotnet.Tests/Aspire.Hosting.Dotnet.Tests.csproj --no-restore -v:qgit diff --checkEarlier local validation blockers, not rerun for this metadata-only follow-up:
MSBUILDTERMINALLOGGER=false dotnet test --project tests/Aspire.Hosting.Tests/Aspire.Hosting.Tests.csproj --no-launch-profile -- --filter-method '*CSharpApp*' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'CanBuildArchiveFromFileBasedCSharpAppreacheddotnet publish, but the local SDK could not create/connect to theCheckForImplicitPackageReferenceOverridestask host (MSB4216/MSB4027 after approximately 5 minutes). Container archive publishing remains unvalidated locally. No publishing implementation changed.MSBUILDTERMINALLOGGER=false dotnet build playground/FileBasedApps/apphost.cs -v:q /p:SkipDashboardReference=trueDistributedApplicationandKnownResourceNames; the standalone file-based AppHost's repository wiring was not resolved.MSBUILDTERMINALLOGGER=false dotnet build playground/FileBasedApps/apphost.cs -v:q /p:ImportDirectoryBuildProps=true /p:ImportDirectoryBuildTargets=true /p:SkipDashboardReference=trueFixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?