Posted by Anuraj on Sunday, September 25, 2016 Reading time :1 minute
This post is about integrating Visual Studio Code with dotnet watch to develop ASP.NET Core applications. Visual Studio code is a free-cross platform editor supports development and debugging of ASP.NET Core applications. You can download the VS Code from http://code.visualstudio.com. dotnet watch is .NET Core tool, which helps to developers to compile the code automatically when they save the code. It is the default behaviour of VS2015. To use this feature, first you need to install dotnet-watch tool. Here is my project.json file’s tools section.
Now instead of using
dotnet run command, use
dotnet watch run command, which will run the web application as well watch for the chnages in the directory, and if any changes found it will re-build the project and re-run the application.
VS Code doesn’t support running
Once you confirmed the installation, VS Code will create two files inside .vscode folder. Open the tasks.json file, by default there will be a build task available, you need to add one more task like this, in which you need to set the IsWatchingCommand as true.
Now you can run the
watch task from VSCode using Command palette, and select run task option, where you will find the
watch command, once you select that it will execute the
dotnet watch run command. To stop the execution you need to select
terminate running task option from Command palette again.
Happy Programming :)
What do you think? I would like to hear your thoughts, suggestions, and questions in the comments section below.