Skip to content
This repository has been archived by the owner. It is now read-only.

Support dotnet watch in launchSettings.json #1067

Closed
RehanSaeed opened this issue Mar 12, 2018 · 4 comments
Closed

Support dotnet watch in launchSettings.json #1067

RehanSaeed opened this issue Mar 12, 2018 · 4 comments

Comments

@RehanSaeed
Copy link

@RehanSaeed RehanSaeed commented Mar 12, 2018

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 aspnet/DotNetTools#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
Copy link

@barrytang barrytang commented Mar 13, 2018

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 barrytang closed this Mar 13, 2018
@barrytang
Copy link

@barrytang barrytang commented Mar 13, 2018

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

@RehanSaeed
Copy link
Author

@RehanSaeed RehanSaeed commented Mar 13, 2018

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

@dharmaturtle
Copy link

@dharmaturtle dharmaturtle commented Mar 21, 2019

@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)",

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants