.Net Core "Hello Worlds" - Part 2

October 11, 2016 | by Esteban Hernandez

In App development, e-learning, developers

As I said in the past post,  this time we are going to talk about how easy is to create the hello app. So, let's get started!

What about the OS?

In this section of the OS no longer matters! Yeah—isn't that cool? Ok, let's get our hands a little dirty:

Initialize Some Code

Let's start a sample Hello World application!

Create a new folder named "hwapp"
Open a terminal window on "hwapp" folder run "dotnet new"

Getting started with a Hello world app
Figure 1: dotnet new command

Run the app

The first command will restore the packages specified in the project.json file, and the second command will run the actual sample:

Start running your app
Figure 2: dotnet restore, dotnet run commands

If everything’s fine, you should get something like this:

Result-Net-hello-worlds.png
Figure 3: dotnet run result

The process is fairly easy so far.  It’s easier than I expected when I first started out, but let’s take a closer look at the code.  Maybe there is a trick or something confusing about the code or files?  This seems too good to be true…

Make sure to check the output
Figure 4: code generation output

Well, it looks pretty normal.  We have program.cs, project.json, project.lock.json in compile folders. I feel something is missing: .sln for solution and .cproj for project. I guess you want to see the program.cs file, don't you?

This is how the .cs file should look
Figure 5: Program.cs file

This is better than expected!  It's just the same code that I wrote “hello world” on in .Net framework. The same syntax and namespeces (so far). It's very exciting to see this wonderful work.

I’ll keep exploring this tool, and perhaps I’ll publidh in this blog an example later on just to try it out.

Thank you for reading and enjoy trying out this technology on your own!