With the C# Dev Kit extension installed in Visual Studio Code, the debugger allows you to apply C# code changes while debugging, this is what we have come to know as Hot Reload.
To get started with Hot Reload in VS Code you will need to update the csharp.experimental.debug.hotreload inUser settings (under File > Preferences > Settings). You can of course explicitly apply changes by clicking the fire icon (or pressing Ctrl-Shift-Enter), alternatively you can automatically apply changes when you save a file by setting the csharp.debug.hotReloadOnSave setting to true.
As of the date of this writing there are a couple of important differences in the feature set compared to the Visual Studio:-
- ASP.NET Core applications will not automatically refresh the browser after a change is made.
- Code changes will only be applied while actively debugging.
Multi OS support for VS Code is a real strength, however, Hot Reload on Linux/Mac needed additional runtime support which means that .NET 8+ is required for Hot Reload on these operating systems.
Project types that support Hot Reload on Linux/Mac include:
- ASP.NET Core (.cs files only)
- Class Library
Project types that do not support Hot Reload on Linux/Mac include:
- Maui (coming soon)
For more details please check out the Hot Reload docs here.