Hello World with .NET Core using Visual Studio 2015 and above
by admin • February 7, 2017 • .NET Core, ASP.NET Core • 0 Comments
We already tried .NET core with command line tools and SDK in the previous post. In this post, we’re going to see how to create a Hello World program in .NET Core using Visual Studio 2015 or above. Let me tell you, this is even easier than the command line tools. It only takes time to install the Visual Studio and related things, while creating and running the project is as easy as A-B-C!
You need to download the right package. I’m writing this post with Visual Studio 2015, but you can use the latest one – Visual Studio 2017 is on the way! 🙂
To install the right package, you need to select Visual Studio from the environment and then download Visual Studio 2015 with Update 3 (or above). If you already have Visual Studio 2015 installed then you can just download Update 3 or above. You also need to download .NET Core tools preview. All this can be seen in the screenshot below.
It will take quite some time to download all the package and install it. But that wait it worth it! It will be a lot easier an quicker to create projects with .NET Core later on.
Once it is installed, you can simply create a new project using File -> New Project and selecting Console Application (.NET Core). This will setup your project and you’ll be ready to add code into it. Just add one line to write Hello World and then run the project.
The code is very simple as you might have already seen for .NET.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace HelloWorldCorewithVisualStudio { public class Program { public static void Main(string[] args) { Console.WriteLine("HelloWord .NET Core with Visual Studio"); Console.ReadLine(); } } } |
To see full project structure you can check the Hello World .NET Core project with Visual Studio on Github.
