2.2 Creating a new ASP.NET Core project

Sho Shimoda
2 min readJun 29, 2023

--

With our development environment properly set up, we’re ready to dive into ASP.NET Core development. In this module, we’ll guide you through creating your first ASP.NET Core project. This project will serve as the starting point for our future exploration.

1. Creating a new project with the .NET Core CLI:

Open a terminal or command prompt window, navigate to the folder where you want to create your project, and run the following command:

dotnet new webapp -o MyFirstAspNetCoreApp

Here, dotnet new webapp tells .NET Core to create a new web application, and -o MyFirstAspNetCoreApp specifies the output directory for the project files.

2. Creating a new project with Visual Studio:

If you’re using Visual Studio, you can create a new project directly from the IDE.

  • Launch Visual Studio.
  • From the top menu, select File > New > Project.
  • In the ‘Create a new project’ dialog, select ASP.NET Core Web Application and click Next.
  • Give your project a name, for example, ‘MyFirstAspNetCoreApp’, and click Next.
  • Select .NET Core and ASP.NET Core latest version from the dropdown lists. Choose Web Application as the project template. Ensure that the 'Configure for HTTPS' box is checked, and click Create.

Congratulations, you’ve created your first ASP.NET Core project!

To run the application, navigate to the project’s directory in your command prompt or terminal and execute the command dotnet run. If you're using Visual Studio, simply press F5 or Ctrl + F5 to start the application. Your web application will run on a local server (usually https://localhost:5001).

Once the application is running, open your preferred web browser and enter the local server’s URL. You should see a default welcome page, indicating that your ASP.NET Core application is up and running.

In the next module, “Exploring the Project Structure and Files,” we will dive into the generated files and directories, helping you understand the structure and purpose of each component. Understanding this will provide a solid foundation for more complex ASP.NET Core projects.

Next: 2.3 Exploring the project structure and files

--

--

Sho Shimoda

CEO/CTO of {RECEIPT}ROLLER. We offer easy digital receipt solutions for all POS and e-commerce, eliminating paper waste.