小智 27

dotnet run --launch-profile "SampleApp"
Run Code Online (Sandbox Code Playgroud)

此方法目前仅支持使用 .NET 6 的 Kestrel 配置文件。例如,--launch-Profile唯一支持在文件中"SampleApp"定义commandName的。"Project"launchSettings.json

{
  "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"
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)


Jas*_*son 8

我认为默认设置只是列表中的第一个配置文件。