Raymond Raymond

.NET Hot Reload in Visual Studio Code

event 2022-03-26 visibility 10,751 comment 0 insights toc
more_vert
insights Stats

Hot Reload is a very useful feature that is introduced in Visual Studio to enable developers to save the time to restart applications after live code editing. It can improve your productivity when developing solutions in Visual Studio. This page shows you how to do that in Visual Studio Code.

Create launch profile with hot reload

In .NET launchable projects like console, website and others, create launch profile in folder Properties\launchSettings.json. You can add profiles in "profiles" property in the document:

    "profiles": {
        "hotreloadprofile": {
            "commandName": "Project",
            "launchBrowser": true,
            "environmentVariables": {
                "ASPNETCORE_ENVIRONMENT": "Development",
                "Key": "Value"
            },
            "applicationUrl": "https://localhost:5001;http://localhost:5000",
            "hotReloadProfile": "aspnetcore"
        } }

Remembers to add hotReloadProfile property accordingly. 

Depends on the project type, the possible values are:

  • Blazor WebAssembly: blazorwasm
  • ASP.NET Core application: aspnetcore

Launch application with hot reload

Now you can use the following command line to launch the application with hot reload:

dotnet watch run --launch-profile hotreloadprofile

 

More from Kontext
comment Comments
No comments yet.

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts