-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[dotnet-run] Allow overriding launch profile environment variable values #45740
Comments
Triage @tmat Chet said you were willing to potentially implement this. Is this something you were willing to take on? The environment part is probably straight forward but the trick here would be ensuring that the launch profile doesn't override a value specified by the -e option. |
I can give it a try and see if I can figure it out. |
If we go with |
We get them for free from S.CL and I believe other teams have used them in the past (we had bugs logged a couple years ago where an S.CL update accidentally removed them and teams screamed). This |
OK. Just seems odd to have 2 features that do similar things but are different in subtle ways. |
dotnet run -lp Profile
uses env variables from the specified profile and ignores the values set in the current environment.This is true even when the environment variable is explicitly set via an environment directive, e.g.
dotnet [env:X=Y] -lp Profile
.As a result, there is no way to override an environment variable value set in the profile.
dotnet-watch
launches projects viadotnet run
. When invoked by Aspire DCP server it needs to implement Aspire launch profile semantics, which require any explicitly specified environment variable value to override the value in the launch profile. To implement this protocol correctly we need to be able to invoke dotnet run with specified env variable values overridden.Possible options:
run
to only set env vars from the LP if there isn't a value already set in the executing environment [breaking change]run
to only set env vars from the LP if there isn't a value already set in the by[env:X=Y]
directive [less breaking]run
to have a new-e
/--environment
KEY=VALUE
option that can be used to override the value [almost not breaking]Note:
Command line arguments passed explicitly on dotnet run command line override those specified in launch profile. This is the desired behavior and it seems environment variables should behave the same way.
Related env variable directive issue:
#40484
The text was updated successfully, but these errors were encountered: