Enable Hot Reload in Visual Studio 2022

Hot Reload is one of the coolest features of the newly released Visual Studio 2022. It enables to apply code changes in debug mode or while is running without rebuilding the application.

For me, this is a huge time saver. When I modify a windows forms application, I hit ALT+F10(hot reload shortcut) and my application has been modified. You can set it up to reload on the save of a file.

Hot Reload Visual Studio

Use at least Visual Studio 2022  and .NET 6

The Hot Reload feature was first available in Visual Studio 2019 version 16.11 but has been working at full capacity since Visual Studio 2022. Also, you need to use .NET 6 as a framework.

If you want to enable Hot Reload on an existing project, target .NET 6.

Enable Hot Reload on File Save

Open the Tools->Options menu, go to Debugging, and choose the .NET / C++ Hot Reload option. In that window, check all the available options:enable hot reload

Edit launchSettings.json

You should edit the launchSettings.json file, which can be found in the Properties folder. Change the profile that relies on the Project command name:

"RandomGenerator": {
      "commandName": "Project",
      "hotReloadProfile": "aspnetcore",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },

From now on, the hot reload feature should work. Change a file, save it while your app runs, and see if it’s modified. You can trigger the hot reload by pressing on the icon or hitting ALT+F10. If it’s not working, open the package manager console, navigate to the project folder and execute the following command: dotnet watch.

Dotnet Watch - Hot Reload

The Hot Reload feature works great with ASP.NET websites, Winforms applications, and .NET MAUI apps.

Not all changes are compatible with this feature, but you will see a popup asking you to rebuild the application.

1 thought on “Enable Hot Reload in Visual Studio 2022”

Leave a Comment