.NET Core Console Applications On Mac OS X, Ubuntu 14.04 And Windows 10 - Part Two

Introduction

This article demonstrates how to create console applications on Mac OS X (10.12.3). In my previous article, I have covered .NET Core on Ubuntu 14.04 and Windows 10. Please refer to my previous article. This article gives the details of OS versions, Tools set, and 2 demos on only Mac OS X.

The code tested on the below Operating System versions.

  • Mac OS X (10.12.3)
  • Ubuntu 14.04
  • Windows 10

Tool Set

  • .NET Core 1.0.4
  • .NET Command Line Interface (CLI) Tools
  • Text Editors: gedit (Ubuntu 14.04), and Notepad (Windows)
  • Visual Studio Code (1.12.2)
  • Git

Source Code Link - https://github.com/vishipayyallore/SpeakerSessions/tree/master/CSharpCorner_20May2017

Demo 1 Console application using terminal, CLI and Text Editor

Mac OS X (10.12.3)

.net core

Get the latest code from GitHub at this source code link.

.net core

Open the Program.cs in Text Editor (in my case, TextEdit on Mac OS X). Add a comment to the Main method. The line has been highlighted below.

  1. class Program {  
  2.     /// <summary>  
  3.     /// Same code works in Ubuntu 14.04 and Windows 10.  
  4.     /// It also works in Mac OS!!!!  
  5.     /// </summary>  
  6.     static void Main(string[] args) {  

.net core

Execute the following to view the program execution.

  • dotnet restore
  • dotnet run

.net core

Push the changes back to GitHub.

Demo 2 Console application using terminal, cli, and Visual Studio Code

Mac OS X (10.12.3)

Get the latest source code from GitHub. Open GenericsDemo folder in Visual Studio Code. Execute "dotnet restore" within integrated terminal of Visual Studio Code.

dotnet restore

.net core

In our previous article, we discussed about .NET Core Launch and .NET Core Attach. Please refer to my previous article for more information.

.net core

Execute the program. Try both, .NET Core Launch and .NET Core Attach.

.net core

We can use the integration Git within Visual Studio Code to push the code to GitHub.

Summary

In this article, I discussed how we can create console applications using .NET Code and C#. We also saw how to create these in Mac OS X (10.12.3), Ubuntu 14.04 and Windows 10. We also saw that the same code works on Mac OS X (10.12.3), Ubuntu 14.04, and Windows 10.

Up Next
    Ebook Download
    View all
    Learn
    View all