Develop .NET Core Console App Running on macOS

Develop .NET Core Console App Running on macOS

The .NET Core Framework was released yesterday from Microsoft. I installed it on my MacBook Pro and developed a small console application using Visual Studio Code. My main goal was to get a feel for using Visual Studio Code to create and debug simple console and web applications using C# on macOS for .NET Core.

6/29/2016 - For a step-by-step tutorial, read Visual Studio Code for Developing .NET Core C# Apps on macOS. I also wrote a step-by-step tutorial for getting started developing ASP.NET Core Web Applications.

First, one needs to install the C# Extension for Visual Studio Code to get C# support. I then created an empty directory using Visual Studio Code's Terminal window and typed "dotnet new" and "dotnet restore". This created a sample Hello World console application that I used as the basis for my .NET Core app.

I opened Program.cs and wrote a quick C# console application that detected palindromes. To get debugging for .NET Core and C# in Visual Studio Code you need to create a launch.json file and point the configuration to the console program. The debugging experience is really good at first glance. I'm not expecting an experience as good as Visual Studio. As long as I can set breakpoints, watch variables, and step into and out of code I am pretty happy.

Debugging .NET Core C# Apps using Visual Studio Code

Once I had the .NET Core application debugged, I returned to the terminal window in Visual Studio Code and typed "dotnet run". This ran the console application and it worked as expected!

Developing .NET Core Console Apps using Visual Studio Code

Creating the C# Console Application for .NET Core and running it on macOS was really easy. I am looking for forward to adding Entity Framework Core 1.0 as well as building an ASP.NET Core sample web application.

If you're interested in install .NET Core for macOS, go to dot.net/core.