【问题标题】:Purpose of dotnetRunMessages in launchSettings.jsonlaunchSettings.json 中 dotnetRunMessages 的用途
【发布时间】:2021-05-01 12:27:09
【问题描述】:

在 ASP.NET Core 5 中,模板在 launchSettings.json 中提供了此功能:

"MyProject": {
  "commandName": "Project",
  "dotnetRunMessages": "true",    // <<<<<<<<
  "launchBrowser": true,
  "applicationUrl": "https://localhost:5001;http://localhost:5000",
  "environmentVariables": {
    "ASPNETCORE_ENVIRONMENT": "Development"
  }
},

dotnetRunMessages 没有在任何地方记录。它有什么作用?

【问题讨论】:

    标签: asp.net-core asp.net-core-5.0


    【解决方案1】:

    据我所知,这个设置的全部目的是在终端内运行dotnet rundotnet watch 时提供一些即时反馈。

    如果不将其设置为 true,在创建新的 .net core/.net 5 应用程序后的第一次运行时,可能需要几秒钟才能显示一些实际的文本反馈,这可能会使用户感到困惑。

    它是由 GitHub 上的这个问题开始的:https://github.com/dotnet/sdk/issues/12227,您可以在其中找到有关其背后原因的更多详细信息。


    除此之外,如果您想在 VS 2019 中利用 dotnet watch 的强大功能,最好将此标志设置为 true,因为到达控制台的消息似乎更冗长。

    "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"
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-02-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-23
      • 1970-01-01
      • 2022-10-13
      • 1970-01-01
      相关资源
      最近更新 更多