Run and debug .NET Core and ASP.NET Core apps with launch profiles
A .NET Core or ASP.NET Core application can have its launch profiles configured with launchSettings.json. These profiles are auto-imported to the corresponding run/debug configurations, which you can then use to run and debug the application. Launch settings profiles for ASP.NET Core apps are often used to run and debug these apps in IIS Express.
What is launchSettings.json
launchSettings.json, which is placed in the Properties folder of a project, describes how the application can be launched — the command to execute, whether the browser should be opened, which environment variables should be set, and so on. This information can then be used by JetBrains Rider, by dotnet run, or by any other tool to run or debug the application.
This article details the conventions used in launchSettings.json. The example below shows a sample launchSettings.json with two launch profiles: IIS Express
and Sample
.
Create run/debug configurations based on launchSettings.json
When you open a project with launchSettings.json for the first time, JetBrains Rider will pick the available launch profiles and automatically create corresponding run/debug configurations, which you can then use to run and debug the project.
For example, after cloning and opening the Orchard CMS, JetBrains Rider will create the following run/debug configurations from the launchSettings.json files:
JetBrains Rider only generates run/debug configurations automatically when no user-defined run configurations were created in the solution before. If there are existing run/debug configurations, you can right-click launchSettings.json in the Solution Explorer and choose Generate Configurations to import the project's launch profiles into run/debug configurations.
If you remove all run/debug configurations from the solution and reopen it, JetBrains Rider will generate new run/debug configurations based on launch profiles in launchSettings.json.
Run and debug launch profiles
When launch profiles are imported as run/debug configurations, you can choose the corresponding configuration on the toolbar and click Run or Debug :
If a project has launchSettings.json, but there are no corresponding run/debug configurations for some reason, you can right-click the project in the Solution Explorer and choose Run '...' or Debug '...'. In this case, JetBrains Rider will create a temporary run/debug configuration for the first launch profile in the project's launchSettings.json and execute it.
You can also open a launchSettings.json in the editor and use the gutter icons to run or debug any launch profile:
In this case, JetBrains Rider will also create a temporary run/debug configuration for this profile.
Edit launch settings profiles
A run/debug configurations based on a launch profile includes two kinds of parameters:
Parameters from launchSettings.json, which you can configure by editing the file — use syntax highlighting, code analysis, and code completion when editing:
Additional configuration parameters added by JetBrains Rider, such as the target framework to use or .NET runtime arguments. To configure these parameters, choose
from the menu and pick the corresponding configuration.Parameters from launchSettings.json are shown as read-only; all other parameters are editable: