launchSettings.json中dotnetRunMessages的目的是什么?

35

在 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没有任何文档说明,它是用来做什么的?

1个回答

45
这个设置的整个目的,据我所知,实际上还没有正式记录在任何地方,它的作用是在终端内运行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
}

Intellisense 说:“设置为 true 以在构建时显示一条消息。” - Greg Gum

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接