Reputation: 195
i am trying to set dotnet-watch in VS2017
so far i can run command 'dotnet watch run' from command line and it works fine, but sometimes i'd like to use debugger and set some breakpoints in code
is it possible to do this setup in VS2017? I have modified 'launchSettings.json':
"Development watch": {
"executablePath": "C:\\Program Files\\dotnet\\dotnet.exe",
"commandLineArgs": "watch run",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:50403/"
}
but this doesn't work - VS2017 locks files from editing which beats the purpose. And i get some strange error so i guess my configuration is not correct.
Upvotes: 4
Views: 2293
Reputation: 12815
Probably, you are missing commandName
parameter. And it should be equal to Executable
.
Here is configuration that worked for me:
"Watch": {
"commandName": "Executable",
"commandLineArgs": "watch run",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"executablePath": "C:\\Program Files\\dotnet\\dotnet.exe",
"launchBrowser": true,
"launchUrl": "http://localhost:5000"
}
And to unlock files - try to uncheck Enable Edit and Continue setting in Tools -> Options -> Debugging. This worked for me, the only issue I still have for now - debug does not work. It will even stop on a break point, but if I try to run Continue - it will throw an error.
UPDATE:
Actually, debug appeared to be OK after I stopped debugging and attached to all dotnet
processes I have.
Upvotes: 1
Reputation: 100543
This is not supported since VS would need to attach its debugger to the child processes launched via dotnet watch
(and actually dotnet run
in turn) even if it let you edit these files.
If you run dotnet watch run
manually and attached VS to the correct process, editing a .cs
file will terminate the old application and you'll have to re-attach again.
This scenario would only work if VS itself had a watch-and-restart logic.
Upvotes: 1