Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dotnet CLI Hot Reload: always restart app on rude edits?

When using Hot Reload in the .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

... any rude edit leads to the following prompt:

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)?

Is there any way to tell the CLI to default to "Always"? Something like dotnet watch --always-restart?

(asking because I'd like to run dotnet watch in a container)

like image 716
Max Avatar asked Dec 06 '25 09:12

Max


1 Answers

As it turns out, yes!

$ export DOTNET_WATCH_RESTART_ON_RUDE_EDIT=1
$ dotnet watch

(.NET 6.0.2+)

like image 119
Max Avatar answered Dec 08 '25 23:12

Max



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!