Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run asp.net core app automatically after changes in c# files

I am running ASP.NET Core application on Visual Studio Code on a mac. To run the app, I use dotnet run from the terminal.

Whenever I make changes in one of the C# files, I have to stop and restart the app by hitting ctrl+c first and dotnet run again.

I watched Pluralsight course of Scott Allen, where he uses Visual Studio and after an edit to any C# files, he just reloads the page and it shows the changes. I am wondering if I can do the same in Visual Studio Code.

like image 323
Akshay Khot Avatar asked Nov 07 '16 15:11

Akshay Khot


1 Answers

I think that dotnet watch should work. See the documentation from the link as there are various options. Here I copied the order in which this should work.

  1. Add Microsoft.DotNet.Watcher.Tools to the tools section of the project.json file
  2. Run dotnet restore
  3. Execute with dotnet watch run
like image 113
Igor Avatar answered Oct 20 '22 22:10

Igor