Creating .NET Core applications using Visual Studio

We have discussed the .NET Core commands to create, build, run, and publish .NET Core applications. We have also covered how to create and run ASP.NET Core applications and unit testing projects.

Now, let's look at how to do it easily using Visual Studio 2017. To create a .NET Core application using Visual Studio, open the Visual Studio 2017 instance and click on File | New | Project... to open the New Project window (alternatively, you can press the following keyboard shortcut: Ctrl + Shift + N):

In the New Project dialog, navigate to Installed | Templates | Visual C# | .NET Core. Here you will see five types of template:

  • Console App
  • Class Library
  • Unit Test Project
  • xUnit Test Project
  • ASP.NET Core Web Application

You can select the template you want to create. To demonstrate, let's create a console application first. From the available list of project templates, select Console App (.NET Core). Provide a proper name for the project/solution file, select the location, and click on OK to create the project, as shown in the following screenshot:

Like other project templates and unlike the CLI tools for .NET Core, this wizard will create the solution and add the project into it automatically. A class file named Program.cs will be available, which is the entry point to the application:

Let's build the application and run it. You will see a Hello World string printed on the screen. If you navigate to the bindebug etcoreapp1.0 folder path of the project directory, you will see ConsoleApp.dll, which is our application host.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.141.6