在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
在任何地方都没有记录。它有什么作用?
最佳答案
据我所知,此设置的全部目的实际上尚未正式记录,它的目的是在终端中运行dotnet run
或dotnet 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"
}
关于asp.net-core - launchSettings.json中dotnetRunMessages的用途,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65923063/