In ASP.NET Core 5 the template provides this in launchSettings.json
:
"MyProject": {
"commandName": "Project",
"dotnetRunMessages": "true", // <<<<<<<<
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
dotnetRunMessages
is not documented anywhere. What does it do?
(C# ASP.NET Core) The launchSettings.json File and launch Profiles | We learn about the finer details of launchSettings.json file. This file contains various launch profiles to start an application in various modes - such as InProcess, OutOfProcess and direct Kestrel.
The launchSettings.json file is used to store the configuration information, which describes how to start the ASP.NET Core application, using Visual Studio. The file is used only during the development of the application using Visual Studio. It contains only those settings that required to run the application.
BTW ASP.NET 5 is now ASP.NET Core 1.0. This json file holds project specific settings associated with each debug profile, Visual Studio is configured to use to launch the application, including any environment variables that should be used. You can define framework for your project for compilation and debugging for specific profiles.
Create a new ASP.NET core web application with the name LaunchSettingsExample. Choose .NET Core & ASP.NET Core 3.1. You will see the following contents in the launchSettings.json file
The whole purpose of this setting, which indeed is not yet officially documented anywhere as far as I can tell, is to give some immediate feedback upon running dotnet run
or dotnet watch
inside of a terminal.
Without it set to true
, on the first run after creating a new .net core/ .net 5 app, it might take a few seconds before some actual text feedback is shown, which might confuse the user.
It was started by this issue on GitHub: https://github.com/dotnet/sdk/issues/12227, where you can find more details about the reasoning behind it.
Beside that, if you want to leverage the power of dotnet watch
inside VS 2019, it's also better to have this flag set to true
, since the messages that get to the console seem to be more verbose.
"API Watch": {
"commandName": "Executable",
"executablePath": "dotnet",
"commandLineArgs": "watch run",
"workingDirectory": "$(ProjectDir)",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": "true"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With