aspnet / Tooling

Issue tracker and info on Visual Studio tooling for ASP.NET
Other
258 stars 124 forks source link

Support dotnet watch in launchSettings.json #1067

Closed RehanSaeed closed 6 years ago

RehanSaeed commented 6 years ago

I used to be able to use dotnet watch in Visual Studio by adding the following section to launchSettings.json and starting the project without debugging using CTRL + F5.

    "Kestrel (dotnet watch run)": {
      "commandName": "Executable",
      "executablePath": "C:\\Program Files\\dotnet\\dotnet.exe",
      "commandLineArgs": "watch run",
      "launchBrowser": true,
      "launchUrl": "https://localhost:5001/",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },

This used to work in ASP.NET Core 1.1 but no longer does. According to https://github.com/aspnet/DotNetTools/issues/404 the new format for ASP.NET Core 2.0 is:

   "Kestrel (dotnet watch run)": {
      "commandName": "Executable",
      "executablePath": "C:\\Program Files\\dotnet\\dotnet.exe",
      "commandLineArgs": "watch run",
      "workingDirectory": "C:\\Users\\namc\\source\\repos\\WebApplication2\\WebApplication2",
      "launchBrowser": true,
      "launchUrl": "https://localhost:5001/",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }

The problem with this is the hard coded executablePath which is Windows specific and the workingDirectory which is specific to wherever I did a Git clone on my local machine.

barrytang commented 6 years ago

To report new issues, use the Report a Problem tool. The GitHub Issue Tracker for the aspnet/Tooling repo is now deprecated in favor of the Report a Problem tool.

If you encounter a problem with Visual Studio, we want to know about it so that we can diagnose and fix it. By using the Report a Problem tool, you can collect detailed information about the problem, and send it to Microsoft with just a few button clicks. See here for more details.

barrytang commented 6 years ago

Adding @BillHiebert, @abpiskunov and @balachir as FYI.

RehanSaeed commented 6 years ago

Posted to the 'Report a Problem' tool with the same title as this issue.

dharmaturtle commented 5 years ago

@RehanSaeed to address your question in the previous thread:

Is there a way to make the working directory more generic? Having to hard code a path in there is sub-optimal.

You can use "workingDirectory": "$(ProjectDir)",