Saturday, May 21, 2016

.Net Core - Hello World from command line

.Net Core is now RC2 and is hopefully going to be stable and not see major changes. Some very basic developmental structural changes happened across RC1 and RC2 so this is never guaranteed though. RC2 has much cleaner and consistent (with other programming languages) development experience which usually is something like following.

  1. Download and install the language
  2. Create a program
  3. Compile and run it
You can follow these steps below to get up and running with your first .Net core Hello World project.
  1. Download and install .Net core from https://www.microsoft.com/net/core#windows
  2. Open command prompt and create a new directory and 'cd' to that directory
    • mkdir newproject
    • cd newproject
  3. Create a new .Net core project in the 'newproject' directory that we created above.
    • dotnet new
  4. Restore all the dependencies for the project
    • dotnet restore
  5. Compile and run
    • dotnet run
That is all. You have your first .Net Core Hello World! program up and running.

I have created a chocolatey pacage so that .Net core SDK can be installed from command like itself. This package is located here.

With chocolatey, the steps then become as follows.

  1. Install .Net core. Note the -pre that is required because it is a prelease version of .net core. It will install latest .Net core which is RC2 as of this post. This installs .net core and updates the PATH so that 'dotnet' command is available from the command prompt.
    • choco install dotnetcoresdk -pre -y
  2. Refresh PATH for current command prompt session. Chocolatey comes up with pretty neat command for this.
    • refreshenv
  3. Create a new project directory and go to that directory
    • mkdir newproject
    • cd newproject
  4. Create new project
    • dotnet new
  5. Restore all the dependencies for the project
    • dotnet restore
  6. Compile and run
    • dotnet run
That's it. You have a.net core application running while never had to leave the command prompt.

16 comments:

isabellaJoseph said...

Good admin.keep it up.your blog was informative. Thank you for sharing.The Millionaire Guide On Hadoop Training in Chennai To Help You Get Rich.Learn more details....
Android Training in Chennai
Dot Net Training in Chennai

sanjay said...

Nice Blog.Thank you for Sharing. Wonderful post...Embedded Training Institute in Chennai | Embedded Training Institute in VElachery

devo said...

Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge...Diploma Project Center in Chennai | Diploma Project Center in Velachery

Careen joseph said...

I have to voice my passion for your kindness giving support to those people that should have guidance on this important matter.
web design training in chennai

giselle aga said...

Those rules moreover attempted to wind up plainly a decent approach to perceive that other individuals online have the indistinguishable enthusiasm like mine to get a handle on incredible arrangement more around this condition
Dotnet Training in Marathahalli

Adlina Jessi said...

Great Article.. Very interesting blog which helps me to get the in-depth knowledge about the technology. Thanks for sharing such a great blog..Software Testing Training Institute in Chennai | Selenium Training Institute in Chennai | ISTQB Training Institute in Chennai

ASO Services said...

Good post and I like it very much. By the way, anybody try this app development company for iOS and Android? I find it is so professional to help me boost app ranking and increase app downloads.

John Alert said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a .Net developer learn from .Net Core Training in Chennai. or learn thru .Net Core Training in Chennai. Nowadays Dot Net has tons of job opportunities on various vertical industry.
or Es6 Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry.

JamesWilliam said...

Interesting post! This is really helpful for me. I like it! Thanks for sharing!
Mobile application developers in Chennai | PHP developers Chennai

Rajesh said...

Thanks for one marvelous posting! I enjoyed reading it;Great post.The information was very useful.Keep the good work goin on!!
Hadoop training in chennai | Mainframe training in chennai | SAP SD training in chennai

Mani said...

Your blog is really interested.Please keep sharing.

Hadoop online Training \ Informatica Online Training \ ETL Testing Online Training

Mani said...

Tutorial is very great.your sharing content is very interested.Thanks to sharing.keep it.

UNIX Shell scripting training in chennai \ ORACLE apps finance training in chennai

aravindsai said...

Great posting with useful topics.Thank you.
PHP Online Training
Pega Online Training
Oracle Soa Online Training

sri krishna kumar said...

A very interesting case study
Sap MM Training In Chennai | Mainframe Training In Chennai | Hadoop Training In Chennai

JamesWilliam said...

Thanks for sharing this niche useful informative post to our knowledge.
brochure designers in chennai | brochure design company in chennai

sumathi s said...

I just needed to record a speedy word to express profound gratitude to you for those magnificent tips and clues you are appearing on this site.
fire safety manager course in chennai