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)
Get the latest code from GitHub at this source code link.
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.
- class Program {
- /// <summary>
- /// Same code works in Ubuntu 14.04 and Windows 10.
- /// It also works in Mac OS!!!!
- /// </summary>
- static void Main(string[] args) {
Execute the following to view the program execution.
- dotnet restore
- dotnet run
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
In our previous article, we discussed about .NET Core Launch and .NET Core Attach. Please refer to my previous article for more information.
Execute the program. Try both, .NET Core Launch and .NET Core Attach.
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.