Skip to main content

ASP.NET Core Setup - Create Your First Project

Level: Beginner

ℹ️ Where This Fits

Use this page to prepare your machine and run your first ASP.NET Core app. Do not skip setup, because every later article assumes you can create, run, stop, and modify a local project.

ℹ️ What You'll Learn
  • Install the .NET SDK
  • Check whether .NET is installed correctly
  • Choose Visual Studio or VS Code
  • Create your first ASP.NET Core project
  • Understand the first project files
  • Run the app on localhost
  • Modify routes and test them in the browser
  • Fix common beginner setup issues

What You Need

You need two things:

ToolWhy You Need It
.NET SDKCreates, builds, and runs .NET/ASP.NET Core projects
Code editorLets you write and edit C# code

The SDK is different from the runtime.

TermMeaning
SDKDeveloper tools: create, build, run projects
RuntimeOnly runs already-built apps

For learning, install the SDK, not only the runtime.

Step 1: Install .NET SDK

Windows

  1. Go to dotnet.microsoft.com/download
  2. Download the latest LTS SDK. In 2026, that is .NET 10 LTS.
  3. Run the installer.
  4. Finish installation and restart your terminal.

Verify in PowerShell:

dotnet --version

You should see a version such as:

10.0.x

If your class or company uses .NET 8, that is also okay. The fundamentals are the same.

macOS

Use the installer from Microsoft or Homebrew:

brew install dotnet
dotnet --version

Linux

Package names differ by distro. On Ubuntu/Debian style systems:

sudo apt-get update
sudo apt-get install -y dotnet-sdk-10.0
dotnet --version

If your package source does not provide .NET 10 yet, install the latest LTS SDK available for your operating system.

Step 2: Choose an Editor

Option A: Visual Studio

Best for beginners on Windows.

Install workload:

ASP.NET and web development

Good for:

  • Debugging
  • IntelliSense
  • Project templates
  • Beginners who prefer buttons and UI

Option B: Visual Studio Code

Lightweight and fast.

Install extensions:

  • C# Dev Kit
  • C#
  • .NET Install Tool

Good for:

  • Smaller machines
  • Terminal-based learning
  • Cross-platform development

Step 3: Create Your First Project

Open terminal and run:

dotnet new web -n SchoolPortal
cd SchoolPortal

Meaning:

CommandMeaning
dotnet new webCreate a minimal ASP.NET Core web project
-n SchoolPortalProject/folder name
cd SchoolPortalMove into the project folder

Project Files

After creating the project:

SchoolPortal/
+-- Program.cs <- Where the app starts
+-- appsettings.json <- App settings
+-- SchoolPortal.csproj <- Project file
+-- Properties/
+-- launchSettings.json

What Each File Means

FileBeginner Meaning
Program.csMain startup file for the web app
appsettings.jsonStores configuration such as logging and connection strings
.csproj fileTells .NET project name, target framework, and packages
launchSettings.jsonLocal run settings like ports and browser launch behavior

Do not memorize everything now. Just know where the app starts: Program.cs.

Step 4: Run the App

Run:

dotnet run

You may see:

Now listening on: http://localhost:5000

or:

Now listening on: https://localhost:7001

Open the URL shown in your terminal.

If the app says Hello World!, your setup works.

What is localhost?

localhost means this computer.

When you open:

http://localhost:5000

you are not visiting an internet website. You are calling the ASP.NET Core app running on your own machine.

What is a port?

A port is like a door number.

localhost:5000

means:

Computer: this machine
Door: 5000

If another app already uses port 5000, ASP.NET Core may choose another port or show an error.

Step 5: Modify Program.cs

Open Program.cs.

Replace the default route with this:

💻 Try It — Console App
💡 Paste into Program.cs and run dotnet run again if hot reload does not update.⌥ GitHub
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();

app.MapGet("/", () => "Welcome to School Management System");

app.MapGet("/students", () => "All students will be shown here");

app.MapGet("/students/{id}", (int id) =>
{
return $"Student details for id: {id}";
});

app.MapGet("/teachers/{id}", (int id) =>
{
return $"Teacher details for id: {id}";
});

app.Run();

Test these URLs:

URLExpected Output
/Welcome to School Management System
/studentsAll students will be shown here
/students/101Student details for id: 101
/teachers/5Teacher details for id: 5

Now you have started building the School Management System backend.

Stop the App

In terminal:

Ctrl + C

This stops the local web server.

Common Setup Problems

ProblemWhy It HappensFix
dotnet is not recognizedSDK not installed or terminal not restartedInstall SDK, close terminal, open again
Browser says site cannot be reachedApp is not runningRun dotnet run
Address already in useAnother app is using same portStop that app or use another port
Changes not showingApp did not reloadStop with Ctrl+C and run again
Wrong folderCommand is run outside projectRun cd SchoolPortal
HTTPS warningLocal development certificateTrust dev certificate or use HTTP for now

Useful Commands

CommandUse
dotnet --versionCheck installed SDK
dotnet --infoShow detailed .NET info
dotnet new web -n SchoolPortalCreate minimal web app
dotnet runRun app
dotnet buildCompile app without running
dotnet watch runRun with auto-reload

Beginner Checklist

  • [OK] Installed .NET SDK
  • [OK] Chose editor
  • [OK] Created SchoolPortal
  • [OK] Ran the app locally
  • [OK] Opened localhost URL
  • [OK] Modified Program.cs
  • [OK] Tested routes in browser
ℹ️ Keep This Project

Do not delete the SchoolPortal folder. In the next articles, you will use the same idea to understand Program.cs, request pipeline, middleware, routing, dependency injection, and controllers.

🎯 Interview Favourite

Q: How do you create and run an ASP.NET Core project?

Good Answer: "I install the .NET SDK, then use dotnet new web -n ProjectName to create a minimal ASP.NET Core project. I move into the folder with cd ProjectName and run it using dotnet run. The app starts a local server, usually on localhost with a port. I can then open that URL in the browser and test routes defined in Program.cs."

Practice Before Next Article

  1. Create a new project named SchoolPortal.
  2. Add routes for /students, /teachers, and /fees.
  3. Run the app and test all routes.
  4. Stop the app using Ctrl + C.
  5. Explain what localhost means.
🤖Use AI to Learn Faster

Use ChatGPT, Claude, or Copilot to go deeper on ASP.NET Core setup. Try these prompts:

  • "Why do I need the .NET SDK instead of only runtime?"
  • "Explain localhost and port in simple words"
  • "Give me 5 practice routes for a School Management System"
  • "What should I do if dotnet command is not recognized?"

💡 Tip: After reading this article, paste your own code into AI and ask "What could go wrong here and why?" — fastest way to find edge cases and deepen understanding.

Use these links to continue the full Backend > ASP.NET Core Fundamentals topic from the top menu:

Target search terms for this lesson: asp.net core setup, create asp.net core project, dotnet new webapi, visual studio asp.net core setup.


Next Article

-> Program.cs and the Host Builder

nexcoding.in