Create .NET Core Project using VS Code – Beginner’s Guide
👋 Introduction
Hey there, future .NET Core developer! 👨💻👩💻
Ever felt stuck trying to set up your .NET Core project in VS Code? You’re not alone! It can be confusing at first, but don’t worry—I got your back. Today, we’ll break it down into super simple steps. By the end, you’ll have your first .NET Core project up and running in VS Code. 🎉
📚 What You Are Going to Learn in This Lesson
✔️ How to install .NET SDK and VS Code
✔️ Necessary extensions for .NET Core development in VS Code
✔️ How to set up a new .NET Core project
✔️ How to run and test your first .NET Core application
✔️ How to add and modify code in VS Code
✔️ How to debug your application easily
Sounds exciting? Let’s go! 🚀
🛠 Step 1: Install .NET SDK and VS Code
Before we start coding, we need to set up our environment.
1️⃣ Install .NET SDK
.NET SDK (Software Development Kit) allows you to create and run .NET Core applications. Download it from here:
👉 Download .NET SDK
2️⃣ Install Visual Studio Code
VS Code is a lightweight but powerful code editor. Get it from here:
👉 Download VS Code
Once installed, open VS Code. Ready? Let’s move to the next step! 🚀
🔌 Step 2: Install Necessary Extensions for .NET Core in VS Code
VS Code is great, but to work smoothly with .NET Core, you need some essential extensions.
📌 Recommended Extensions:
1️⃣ C# Extension (by Microsoft) – Adds IntelliSense, debugging, and syntax highlighting. 🔗 Install
2️⃣ .NET Install Tool (by Microsoft) – Ensures you have the correct .NET SDK versions.
3️⃣ Debugger for .NET Core – Helps with setting breakpoints and debugging.
4️⃣ Code Runner – Lets you quickly run C# code without opening a terminal.
👉 To install these:
- Open VS Code
- Press
Ctrl + Shift + X
to open Extensions - Search for the extensions above and click Install
Done? Awesome! Let’s create our first .NET Core project using VS Code. 🚀
🌐 Step 3: Create a .NET Core Web App in VS Code
Now, let’s create a new .NET Core web app.
1️⃣ Open VS Code and open a folder where you want to create your project.
2️⃣ Open Terminal (Press Ctrl + ~
or go to View
> Terminal
).
3️⃣ Run this command to create a new ASP.NET Core web app:
dotnet new webapp -n MyFirstWebApp
What’s happening here?
dotnet new webapp
: Creates a new ASP.NET Core web app.-n MyFirstWebApp
: Names the project “MyFirstWebApp”.
4️⃣ Move into the project folder:
cd MyFirstWebApp
Woohoo! 🎉 Your first .NET Core web app is created. Now, let’s run it.
🚀 Step 4: Run Your .NET Core Web App
Let’s check if everything is working!
1️⃣ Open Terminal in VS Code.
2️⃣ Run this command:
dotnet run
3️⃣ After the app starts, you should see a URL like this:
Now listening on: https://localhost:5001
4️⃣ Open the link in your browser, and you’ll see your first .NET Core web app running! 🎉
💡 Reference
You can learn more on create, debug and run ASP.NET Core project on the official website.
🔥 Next What?
You did it! 🎉 You’ve successfully learned how to create a .NET Core project using VS Code and build your first web app. But this is just the beginning!
In the next chapter, we’ll understand folder structure of ASP.NET Core and explore files inside it. Stay tuned! 🚀