22

In Visual Studio 2017 and 2019 on Windows, I run dotnet watch run in the Package Manager Console. It launched kestrel for a dotnet core app, automatically disabled text edit in the console, and displayed a red button to stop command execution, but the button doesn't do anything. Also, the message is being displayed to use Ctrl+C but it doesn't work either.

Now listening on: http://localhost:20436 Application started. Press Ctrl+C to shut down.

Now there is an error when I try to launch the web app in Visual Studio because it is already running. I couldn't find a command like dotnet stop only Ctrl+C which doesn't work in this case. I used Process Hacker to kill the dotnet.exe process but that doesn't seem right. What would be the best way to kill the running process?

Roman Svitukha
  • 1,302
  • 1
  • 12
  • 22

4 Answers4

0

Since this stop option doesn't work it is clearly a bug. If I need to run dotnet watch run I generally just open command line on my current folder outside VS and run it from there. Since dotnet watch run has nothing to do with visual studio (no debugging) it makes sense. Alternatively, you can use the green button to run within visual studio with debugger. However, this would mean you can't edit the code while testing.

Neville Nazerane
  • 6,622
  • 3
  • 46
  • 79
  • Usually for testing I lunch apps normal way F5 or green button, but for being able to see updates on the fly I assumed that one Microsoft product would work flawlessly with another one. Looks like the best option for now is to use command line outside Visual Studio. – Roman Svitukha Dec 16 '18 at 05:48
  • yes, it is supposed to. this seems to be a bug. I never really try doing this from vs – Neville Nazerane Dec 16 '18 at 06:15
  • have you tried this solution? https://stackoverflow.com/questions/40152854/how-to-watch-for-file-changes-dotnet-watch-with-visual-studio-asp-net-core – Neville Nazerane Dec 16 '18 at 06:15
  • It is not a bug you just have to press the stop button :) – AlThePal78 Nov 05 '21 at 21:21
0

run your project:

dotnet run > Examplelog.log &

$ dotnet run > Examplelog.log &

[1] 162


end your project:

kill 162

$ kill 162

[1]+ Exit 127 dotnet run > Examplelog.log


So with kill[id] you can end your process.

you not need a second console and can use your console for other inputs (take note that all outputs will be stored inside the Examplelog.log-File you have to check)^^lg

DarioDS
  • 5
  • 4
0

when the service is already running just again apply build command "dotnet build" and then again run command apply like "dotnet run" services will be up again then you just have to press Ctrl+c in the terminal to shutdown running services.

sohail naseer
  • 71
  • 1
  • 4
-2

There is a red button next to the clear button in that section next to the project name. I just found it LOL I will show you a picture follow the yellow circle. I was trying ctrl+c too LOLenter image description here

AlThePal78
  • 793
  • 2
  • 14
  • 25