Detect code changes and restart application using .NET Core file watcher

When you run a ASP.NET Core application using dotnet run CLI command, the application is started for you and made available at a specific URL and port. During development stage it's very common to make changes to C# code such as models, controllers, and other classes. To see these modifications in action you need to stop the application and again execute the dotnet run CLI command. Wouldn't it be nice if there is some way to detect such code changes and re-start the application automatically? Luckily, there is a tool called file watcher that does the trick. Let's see how.