Obsolete PublishAsConnectionString#18044
Conversation
Mark the Hosting and Azure PublishAsConnectionString APIs obsolete because they only affect manifest publishing and do not update the publisher resource model. Update TypeScript codegen snapshots and suppress the intentional obsolete usages in existing coverage. 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 -- 18044Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 18044" |
There was a problem hiding this comment.
Pull request overview
Marks PublishAsConnectionString as obsolete (with manifest-only behavior called out) to prevent callers from assuming it changes the publish-time resource model for all publishers, and updates generated TypeScript output and usages accordingly.
Changes:
- Added
[Obsolete]+ XML<remarks>to Hosting and AzurePublishAsConnectionStringextension methods clarifying manifest-only behavior. - Updated the TypeScript generated snapshot to include the same manifest-only note and
@deprecatedguidance. - Suppressed CS0618 in existing test and playground code that intentionally exercises the obsolete behavior.
Show a summary per file
| File | Description |
|---|---|
| tests/Aspire.Hosting.Tests/PublishAsConnectionStringTests.cs | Suppresses CS0618 for the obsolete API in a targeted test. |
| tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.ts | Updates TS snapshot docs to include manifest-only + @deprecated guidance. |
| src/Aspire.Hosting/ParameterResourceBuilderExtensions.cs | Obsoletes Hosting PublishAsConnectionString and documents manifest-only behavior. |
| src/Aspire.Hosting.Azure/AzureResourceExtensions.cs | Obsoletes Azure PublishAsConnectionString and documents manifest-only behavior. |
| playground/ParameterEndToEnd/ParameterEndToEnd.AppHost/AppHost.cs | Suppresses CS0618 in a playground scenario that still uses the obsolete API. |
Copilot's findings
- Files reviewed: 5/5 changed files
- Comments generated: 1
JamesNK
left a comment
There was a problem hiding this comment.
LGTM. Clean deprecation — both overloads obsoleted consistently, manifest-only behavior documented in remarks, suppressions scoped to intentional test/playground usage, and TypeScript snapshot updated with @deprecated.
Limit the CS0618 suppression in the ParameterEndToEnd AppHost so it only covers the intentional PublishAsConnectionString call instead of the surrounding fluent chain. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
❓ CLI E2E Tests unknown — 113 passed, 0 failed, 2 unknown (commit View all recordings
📹 Recordings uploaded automatically from CI run #27189263684 |
… use AddConnectionString - Update 'Parameter example' in external-parameters.mdx to use execution-context-based pattern (IsRunMode) instead of the now-obsolete PublishAsConnectionString() API - Update the Japanese localized version of external-parameters.mdx to match - Mark PublishAsConnectionString as obsolete in the azure/overview.mdx API table and add a migration caution callout showing the AddConnectionString pattern with execution context Relates to microsoft/aspire#18044 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Pull request created: #1237
|
|
📝 Documentation has been drafted in microsoft/aspire.dev#1237 targeting Updated three documentation pages to document the
Note This draft PR needs human review before merging. |
Description
PublishAsConnectionStringonly changes the manifest representation of a resource. Current non-manifest publishers use the resource model directly, so callers can be misled into thinking this API converts the resource into a publish-time connection string parameter for all publishers.This marks the Hosting and Azure
PublishAsConnectionStringextension methods obsolete with guidance to useAddConnectionStringin publish-mode app model code instead. It also adds XML remarks describing the manifest-only behavior, updates the TypeScript generated snapshot so TS AppHost users see the same@deprecatedguidance, and suppresses the obsolete warning only in existing test/playground code that intentionally covers the old behavior.Migration guidance
Existing callers will now get a CS0618 warning. Apps that need different run and publish behavior should model that explicitly, for example by adding a local resource in run mode and an
AddConnectionStringresource in publish mode.Breaking changes
This obsoletes the public
PublishAsConnectionStringAPIs. Existing callers continue to compile, but will receive an obsolete API warning directing them away from the manifest-only API.Fixes: #8409
Checklist
<remarks />and<code />elements on your triple slash comments?