Configure Environment of AppHost in Publish Mode
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Is your feature request related to a problem? Please describe the problem.
When deploying or running Aspire, every project in Aspire has Environment(e,g, Development, Staging, Production).
When we are on Run Mode, we could specify it in launchsettings.json.
But when we are on PublishMode, we could not specify it.
I'm using workaround for this issue.
```C#
if (builder.ExecutionContext.IsPublishMode)
{
var environmentName = builder.AddParameter("hostingEnvironment");
var environmentVariableName = "DOTNET_ENVIRONMENT";
apiService.WithEnvironment(environmentVariableName, environmentName);
webFrontend.WithEnvironment(environmentVariableName, environmentName);
}
```
But this workaround does not works for `builder.Environment` of AppHost itself.
Even if we are deploying for "Production" environment, `builder.Environment` is "Development". It is confusing.
### Describe the solution you'd like
Abillity to select launchSettings.json for each publish profile.
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.