question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 6 years ago
  • Reactions:16
  • Comments:21 (7 by maintainers)

github_iconTop GitHub Comments

7reactions
geirsagbergcommented, Jul 7, 2017

After running dotnet run --help, I noticed the switch --no-launch-profile, which does exactly what I need, so ignore my last comment 😃

3reactions
ygoecommented, Nov 12, 2018

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add support for launchSettings.json to dotnet run #8274
We'd like to add support to dotnet run for honoring the settings in launchSettings.json . Initially we can limit this support to the ......
Read more >
dotnet run command - .NET CLI
The dotnet run command provides a convenient option to run your application from the source code.
Read more >
ASP.NET Core LaunchSettings.json File
In this article, I am going to discuss the ASP.NET Core launchSettings.json File. launchSettings.json file contains project specific settings.
Read more >
Using .NET Core launchSettings.json to run/debug apps in ...
A .NET Core application can have a file called launchSettings.json , which describes how a project can be launched. It describes the command ......
Read more >
c# - What is "dotnet run" default profile setting from ...
For e.g. the --launch-Profile only supports "SampleApp" which commandName is defined as "Project" in launchSettings.json file.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found