Max*_*Max 16 .net asp.net dotnet-cli hot-reload
在 .NET CLI 中使用热重载时...
$ dotnet watch
watch : Hot reload enabled. For a list of supported edits, see https://aka.ms/dotnet/hot-reload. Press "Ctrl + R" to restart.
watch : Building...
...
watch : Started
Run Code Online (Sandbox Code Playgroud)
...任何粗鲁的编辑都会导致以下提示:
watch : Unable to apply hot reload because of a rude edit.
watch : Do you want to restart your app - Yes (y) / No (n) / Always (a) / Never (v)?
Run Code Online (Sandbox Code Playgroud)
有没有办法告诉 CLI 默认为“始终”?就像是dotnet watch --always-restart
?
(询问是因为我想dotnet watch
在容器中运行)
Max*_*Max 13
事实证明,是的!
$ export DOTNET_WATCH_RESTART_ON_RUDE_EDIT=1
$ dotnet watch
Run Code Online (Sandbox Code Playgroud)
(.NET 6.0.2+)
也可以传递非交互式标志:
dotnet watch run --non-interactive
Run Code Online (Sandbox Code Playgroud)
--non-interactive
以非交互模式运行 dotnet watch。使用此选项可以防止请求控制台输入。当启用热重载并检测到粗鲁编辑时,dotnet watch 会重新启动应用程序。自 .NET 7 SDK 起可用。
https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-watch#options /sf/answers/5358684901/
归档时间: |
|
查看次数: |
2327 次 |
最近记录: |