-
Couldn't load subscription status.
- Fork 709
Introduce IAppHostEnvironment interface for centralized AppHost environment information #12156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: davidfowl <[email protected]>
Co-authored-by: davidfowl <[email protected]>
Co-authored-by: davidfowl <[email protected]>
|
@copilot implement the PR feedback |
Co-authored-by: davidfowl <[email protected]>
| /// <remarks> | ||
| /// Used for stable naming across deployments regardless of path (Azure Functions, Azure environments). | ||
| /// </remarks> | ||
| string ProjectNameSha256 { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ProjectNameHash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in commit d7e6daf - renamed to ProjectNameHash
|
@copilot Look for places where we use IHostEnvironment today and replace it with IAppHostEnvironment |
Co-authored-by: davidfowl <[email protected]>
I've reviewed all IHostEnvironment usages. The remaining ones are legitimate:
All AppHost-specific usages have been migrated to IAppHostEnvironment (ProjectName, ProjectDirectory, FullPath, DefaultHash, FullPathHash, ProjectNameHash). |
|
@copilot You missed some cases: PublishModeProvisioningContextProvider and RunModeProvisioningContextProvider use IHostingEnvironment |
…ng providers Co-authored-by: davidfowl <[email protected]>
Fixed in commit 308eecb. Both |
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 12156Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 12156" |
1 similar comment
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 12156Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 12156" |
Implementation Complete: IAppHostEnvironment Interface
Successfully implemented all PR feedback including replacing IHostEnvironment usage in Azure provisioning providers.
✅ Latest Changes:
Replaced IHostEnvironment with IAppHostEnvironment in Azure provisioning context providers:
BaseProvisioningContextProvider- Now uses IAppHostEnvironmentPublishModeProvisioningContextProvider- Uses_appHostEnvironment.ProjectNameinstead of_environment.ApplicationNameRunModeProvisioningContextProvider- Uses_appHostEnvironment.ProjectNameinstead of_environment.ApplicationNameUpdated test infrastructure:
TestAppHostEnvironmenthelper classCreateAppHostEnvironment()helper methodAll Property Names:
AppHost:DirectoryProjectDirectoryAppHost:PathFullPathAppHost:DashboardApplicationNameDashboardApplicationName/ProjectNameAppHost:Sha256DefaultHashAppHost:PathSha256FullPathHashAppHost:ProjectNameSha256ProjectNameHashAppHost:ContainerHostnameContainerHostnameAppHost:DefaultLaunchProfileNameDefaultLaunchProfileNameAppHost:OtlpApiKeyOtlpApiKeyAppHost:ResourceService:ApiKeyResourceServiceApiKeyAppHost:ResourceService:AuthModeResourceServiceAuthModeFiles Updated in Latest Commit:
BaseProvisioningContextProvider.cs- Uses IAppHostEnvironment instead of IHostEnvironmentPublishModeProvisioningContextProvider.cs- Uses ProjectName from IAppHostEnvironmentRunModeProvisioningContextProvider.cs- Uses ProjectName from IAppHostEnvironmentProvisioningTestHelpers.cs- Added TestAppHostEnvironment and CreateAppHostEnvironment helperProvisioningContextProviderTests.cs- Updated all test casesAzureDeployerTests.cs- Updated test casesRemaining IHostEnvironment Usage:
IHostEnvironment is still used in a few places where it's needed for .NET hosting-specific properties:
OtlpConfigurationExtensions- Public API methods checking IsDevelopment()FileDeploymentStateManager- Uses EnvironmentNamePublisher.cs- Uses EnvironmentNameDistributedApplicationBuilderconstructor - Used during initialization before IAppHostEnvironment existsAll builds and tests pass successfully.
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.