Automatically Restarting ASP.NET on OSX with DNXMON

22 May 2015

Write some code, see it run, refactor the code, see it run, refactor … you get the idea. This is what I do all day long. Notice I didn’t say “write code, refactor, stop server, start server, write code …”. Why? Because I prefer my server to detect the code changes and auto-restart. This works great in Node.js with nodemon, so this post shows one option to do that for ASP.NET on OSX.

Learn how to get started with ASP.NET 5 on OSX here
Add this script to your ~/.bash_profile. Then when you type dnxmon . kestrel your ASP.NET app will start and watch the cs and json files. When they change, dnx will restart.

I expect something more elegant to come in time from the ASP.NET team (there is a kmon in the works, using the old name of dnx). But for now, this makes it easy to speed up my development process.

dnxmon

Run dnx server continuously with nodemon watching for changes to cs or json files