Add support for launchSettings.json to dotnet run
See original GitHub issue@livarcocc @DamianEdwards @sayedihashimi @mlorbetske @richlander lander
For ASP.NET Core projects we setup a bunch of useful machinery in our templates when running in Development. Unfortunately none of this machinery gets used when doing dotnet new
and dotnet run
because the default environment is assumed to be Production and nothing specifies that the environment should be Development. The environment is typically specified using an environment variable (ASPNETCORE_ENVIRONMENT).
VS today uses launchSettings.json to drive the F5 experience. This file enables you to specify things like environment variables when the application is launched. You can also specify additional command-line args, and whether the browser should be launched and at what address.
We’d like to add support to dotnet run
for honoring the settings in launchSettings.json
. Initially we can limit this support to the “Project” command name and specifically add support for setting environement variables and command-line args. Later we can look adding support for things like specifying the application URL and launching the browser:
{
"profiles": {
"MyAspNetCoreProject": {
"commandName": "Project",
"commandLineArgs": "--name value",
"launchBrowser": true,
"launchUrl": "https://localhost:44316/",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:44316/"
}
}
}
@DustinCampbell We should also chat about having VSCode support this format
Issue Analytics
- State:
- Created 6 years ago
- Reactions:16
- Comments:21 (7 by maintainers)
Top GitHub Comments
After running
dotnet run --help
, I noticed the switch--no-launch-profile
, which does exactly what I need, so ignore my last comment 😃So
commandLineArgs
isn’t one of the supported options? I don’t know what actually is supported, I just see that “the start options from (my launchSettings.json file) are used”. But command line arguments are not set in the program, nor visible in a task manager.