We don’t deal with .NET framework, or .NET Core anymore. We call it ‘.NET’. As of writing this blog, the latest version available is .NET 5. And, these steps works in previous versions of .NET Core also.
Assuming you have downloaded the latest version of .NET.
Step 1:Open command prompt
Step 2: Type: dotnet new console -name “HelloWorld“
You must see a new folder named “HelloWorld” crated with a directory structure like this:
You can open Program.cs to see its contents. It has a very basic program to display “Hello World!” message.
Step 3: Your .NET console application is ready. First, you have to build it
Type command: dotnet build “HelloWorld”
You can see HelloWorld.exe file is created, in addition to some other files in your folder \HelloWorld\bin\Debug\net5.0
Step 4: Run!
You can simply run the exe file directly going to the location, or by typing this command:
Step 5: Alternate way to run the program
Go inside your program folder, i.e., “HelloWorld“, then type command:
dotnet run HelloWorld
or simply, dotnet run