Update documentation for new polyglot environment variables (issue #5308) #5313
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR updates the Aspire documentation to reflect the new polyglot-friendly environment variables introduced in dotnet/aspire#12141. This addresses issue #5308.
What Changed
Starting in Aspire 13.0, when using
WithReference
to connect services, Aspire now injects two types of environment variables to support both .NET and non-.NET workloads:1. Simplified Format (New)
This now generates simplified environment variables that are easier to use from non-.NET languages:
APISERVICE_HTTP=http://localhost:5455
APISERVICE_HTTPS=https://localhost:7356
Pattern:
{RESOURCENAME}_{ENDPOINTNAME}
in uppercase2. .NET Service Discovery Format (Existing)
The existing .NET service discovery format continues to work for backward compatibility:
services__apiservice__http__0=http://localhost:5455
services__apiservice__https__0=https://localhost:7356
Pattern:
services__{servicename}__{endpointname}__{index}
in lowercaseBoth formats are injected automatically, so existing .NET applications continue to work unchanged, while new polyglot scenarios can use the simpler format.
Custom Environment Variables
For specific endpoint references, developers can use
WithEnvironment
withGetEndpoint
:This generates a single custom environment variable:
PROJECTA_URL=https://localhost:7356
Files Updated
WEATHERAPI_HTTP
)Impact
These documentation updates:
Fixes #5308
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.