I tried to automatically reload ASP.NET Core project as I do using Angular with Node or NPM.
When I change the code of the .NET Core project and save, I want the web page to be automatically refreshed in the web browser.
On Windows, check the Enable XAML Hot Reload checkbox (and the required platforms) at Tools > Options > Debugging > Hot Reload. In earlier versions of Visual Studio 2019, the checkbox is at Tools > Options > Xamarin > Hot Reload.
Today, we are excited to introduce you to the availability of the . NET Hot Reload experience in Visual Studio 2019 version 16.11 (Preview 1) and through the dotnet watch command-line tooling in .
We've changed these settings in the next preview so that hot reload is controlled solely from the Tools\Options\Debugger\Enc&Hot Reload option page, and these settings will only apply when you turn off Hot Reload for Ctrl+F5.
run this command in project console
dotnet watch run
same works for visual studio code
From Develop ASP.NET Core apps using a file watcher (for 3.0)
dotnet watch is a tool that runs a .NET Core CLI command when source files change. For example, a file change can trigger compilation, test execution, or deployment.
The link above contains a tutorial with two sample projects:
Alternatively, you can also this nuget package for runtime compilation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With