Skip to content

aspire publish + launch profiles #8934

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

Open
eerhardt opened this issue Apr 23, 2025 · 2 comments
Open

aspire publish + launch profiles #8934

eerhardt opened this issue Apr 23, 2025 · 2 comments
Assignees
Labels
Milestone

Comments

@eerhardt
Copy link
Member

Today when you call aspire publish, it calls dotnet run on the AppHost project without specifying a launch profile. This means that the first launch profile in launchSettings.json is used to execute the AppHost for publishing.

This is a problem because the first launch profile is meant for F5 / local run mode.

"profiles": {
//#if (HasHttpsProfile)
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:17000;http://localhost:15000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_ENVIRONMENT": "Development",
"ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21000",
"ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22000"
}
},

Specifically the issue is that "DOTNET_ENVIRONMENT": "Development", is set, which means the AppHost is run with builder.Environment.IsDevelopment() == true. This is the wrong default for aspire publish. Instead when you aspire publish, it should be using the Production environment by default.

We should consider how launch profiles work all up with aspire publish. One strategy we could take:

  • Allow the launch profile to be specified via aspire publish. If it is supplied, use it. This allows for multiple publish profiles to be set in launchSettings.json.
  • Have a "default" publish launch profile, for example one named publish. If it is found, use it.
  • Run the AppHost with --no-launch-profile if none of the above 2 are true.

Or we could decide that launch profiles don't make sense at all during aspire publish, and always specify --no-launch-profile. But since we are running the AppHost project, it does feel natural to consider a "launch profile".

cc @mitchdenny @DamianEdwards @davidfowl

@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Apr 23, 2025
@davidfowl
Copy link
Member

I think they don’t make much sense for publish but we do want to give people control. Maybe that means a cli arg that maps to ASPIRE_ENVIRONMENT which sets the env appropriately

@eerhardt eerhardt added area-cli and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Apr 23, 2025
@DamianEdwards
Copy link
Member

I think they don’t make much sense for publish but we do want to give people control. Maybe that means a cli arg that maps to ASPIRE_ENVIRONMENT which sets the env appropriately

I think starting from this (a CLI arg for setting environment) plus passing --no-launch-profile to the app host when running it in publish mode is a reasonable start. We can then look at how folks are using the CLI arg to decide whether it's worthwhile supporting an actual launch profile as part of the publish execution.

@mitchdenny mitchdenny self-assigned this Apr 23, 2025
@mitchdenny mitchdenny added this to the 9.3 milestone Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants