Creating .NET Core applications using Visual Studio 2019

We have spent enough time discussing 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 test projects.

Now, let's see how to do it easily using Visual Studio 2019. To create a .NET Core application using Visual Studio 2019, open the Visual Studio 2019 instance and, from the Start Screen, select Create a new project. Alternatively, you can click the File | New | Project... (shortcut: Ctrl + Shift + N) menu from the Visual Studio 2019 IDE to open the New Project window:

In the New Project dialog, search for .net core, which will list the following project templates:

  • Console App (.NET Core)
  • ASP.NET Core web application
  • Class library (.NET Core)
  • MSTest test project (.NET Core)
  • xUnit test project (.NET Core)
  • NUnit test project (.NET Core)
  • Web driver test for edge (.NET Core)

You can select the template that 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 Create 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 to 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 etcoreapp2.1 folder path (as we have built on .NET Core 2.1) of the project directory, then 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.14.83.223