Skip to content

Document How to Enable Hot Reloading Using dotnet run/watch #38036

Closed
@RehanSaeed

Description

@RehanSaeed

Is your feature request related to a problem? Please describe.

It is not clear how to enable hot reloading using dotnet run or dotnet watch from a launchSettings.json file. The .NET blog mention that we should add the "hotReloadProfile": "aspnetcore" setting like so:

"Kestrel": {
  "commandName": "Project",
  "dotnetRunMessages": true,
  "hotReloadProfile": "aspnetcore"
  "launchBrowser": true,
  "launchUrl": "weatherforecast",
  "applicationUrl": "http://localhost:5093",
  "environmentVariables": {
    "ASPNETCORE_ENVIRONMENT": "Development"
  }
},

However, I also came across this PR which removes this need:

Then there is the question about how to enable the feature when using dotnet watch in a launchSettings.json file:

"Watch Kestrel (CTRL+F5)": {
  "commandName": "Executable",
  "executablePath": "dotnet",
  "workingDirectory": "$(ProjectDir)",
  "commandLineArgs": "watch",
  "environmentVariables": {
    "ASPNETCORE_ENVIRONMENT": "Development"
  }
},

It would also be nice to know if this affects IIS Express or WSL2

    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "launchUrl": "graphql",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "WSL 2": {
      "commandName": "WSL2",
      "launchBrowser": true,
      "launchUrl": "http:////localhost:5000",
      "environmentVariables": {
        "ASPNETCORE_URLS": "http://localhost:5000",
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "distributionName": ""
    },

Describe the solution you'd like

I'd like to know how to enable the feature for both dotnet run and dotnet watch from a launchSettings.json file and have this documented somewhere.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ✔️ Resolution: AnsweredResolved because the question asked by the original author has been answered.Status: Resolvedarea-commandlinetoolsIncludes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPIfeature-dotnetwatchThis issue is related to the dotnet-watch command-line tool (now external)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions