According to MS docs: https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-run?source=docs
and this SO thread How to determine which environment asp.net core app will run in?
I am still unable to determine what is dotnet run
default profile setting from launchProfile.json?
Thanks, Piotr
dotnet run --launch-profile "SampleApp"
This approach only supports Kestrel profiles for now using .NET 6. For e.g. the --launch-Profile
only supports "SampleApp"
which commandName
is defined as "Project"
in launchSettings.json
file.
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:59481",
"sslPort": 44308
}
},
"profiles": {
"SampleApp": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7152;http://localhost:5105",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
The default profile for dotnet run
will be the first profile in launchSettings.json
file, regardless of the profile name and if no launch profile is specified during dotnet run
. This also written in MS Learn Documents such as
ASP.NET Core in .NET 8.0 Envinroments
As the first profile listed, this profile is used by default.
If no launch profile is specified, then the first launch profile is selected by default.