With the introduction of .NET Core developing .NET applications is now quite easy π.
In this tutorial we will see how to create a Hello World! application using command prompt π. The same using visual studio was discussed in an earlier article.
For this tutorial what you need is a computer with any operating system. (power of cross platform π)
- Download the .NET Core SDK. You can get it from here. Download the correct SDK based on your OS.
- Install the SDK on the computer.
- Open command prompt (Windows)/terminal(Linux/Mac-OS) and check whether SDK installed successfully by entering below command
1dotnet
Entering the above command shows the below screen
If you see this you are good to go π else there is some issue with installation π₯ - Β Now we are going to create our new app. Enter the below codes in command prompt
12dotnet new console -o HelloWorldcd HelloWorld
When you execute the above command the dotnet SDK will create a new console application with name HelloWorld. The -oΒ creates a new directory in the name of application i.e HelloWorld. the cd or changeΒ directory command changes the directory to HelloWorld
- Now a folder named HelloWorld is created with a file program.csΒ which contains the default code shown below
123456789101112using System;namespace myApp{class Program{static void Main(string[] args){Console.WriteLine("Hello World!");}}} - Now to run the application enter the below command
1dotnet run
The moment of truth
Success! π₯
Build Pass βNow you are an official C# and .NET Developer, as I said earlier at the tip of the ice berg π.