Complete C# Tutorial

Understanding Project Folders and Files in ASP.NET Core

๐Ÿ‘‹ Introduction

Hey hey! ๐Ÿ‘‹
You just created a new ASP.NET Core project and boom ๐Ÿ’ฅ โ€” a bunch of folders and files youโ€™ve never seen before. You’re like…

“Umm… what even is ‘Connected Services’? And where did my Controllers go?” ๐Ÿ˜…

Don’t worry, my friend. You’re in the right place. Today, weโ€™ll explore the real project structure of ASP.NET Core โ€” without MVC, in its cleanest and simplest form.

Letโ€™s make sense of it together! ๐ŸŽฏ

๐Ÿ—‚๏ธ Breaking Down the Project Structure of ASP.NET Core

So hereโ€™s what youโ€™ll typically see in your new ASP.NET Core Web App (without MVC):

				
					MyWebApp/
โ”‚
โ”œโ”€โ”€ Connected Services/
โ”œโ”€โ”€ Dependencies/
โ”œโ”€โ”€ Properties/
โ”œโ”€โ”€ wwwroot/
โ”œโ”€โ”€ Pages/
โ”œโ”€โ”€ appsettings.json
โ””โ”€โ”€ Program.cs
				
			

Letโ€™s go folder-by-folder, file-by-file. โœจ
This is your new playground. Letโ€™s make it feel like home.

๐ŸŒ Connected Services

This section is where you can connect your app to external services โ€” like Azure, databases, APIs, etc.

Itโ€™s like the โ€œAdd a buddyโ€ zone. You bring in helpers here. ๐Ÿค
Not always used at first, but super handy later.

๐Ÿ“ฆ Dependencies

This is where all your packages and NuGet libraries live.
Think of it as your appโ€™s backpack ๐ŸŽ’ โ€” it carries all the tools you install.

It includes:

  • .NET libraries

  • Third-party packages

  • Framework references

Nothing to edit here, just know whatโ€™s inside. ๐Ÿ˜‰

๐Ÿ  Properties

Inside this, youโ€™ll find a file called launchSettings.json.

This file controls how your app runs during development. Like which browser opens or what port to use.

				
					"profiles": {
  "MyWebApp": {
    "commandName": "Project",
    "launchBrowser": true,
    "applicationUrl": "https://localhost:5001"
  }
}
				
			

โš™๏ธ Basically, itโ€™s a comfy cushion for your app to launch the way you like.

๐Ÿ“ wwwroot

Hereโ€™s your public folder. ๐Ÿ’ก
Everything in wwwroot is accessible to the outside world.

Use it for:

  • CSS
  • JavaScript
  • Images
  • Static files

If you put a file here, users can access it directly in the browser.
Example: wwwroot/css/site.css โ†’ opens at /css/site.css

๐Ÿ“ Pages

Here comes the star of the show โ€” the Pages folder. ๐ŸŒŸ
This is where your Razor Pages live.

Each .cshtml file here is a self-contained page.

				
					Pages/
โ”œโ”€โ”€ Index.cshtml
โ”œโ”€โ”€ Index.cshtml.cs
โ”œโ”€โ”€ Error.cshtml
				
			

Example: Index.cshtml (your homepage):

				
					@page
<h1>Welcome to My Web App!</h1>
				
			

Code-behind file (Index.cshtml.cs):

				
					public class IndexModel : PageModel
{
    public void OnGet()
    {
        // Runs on GET request
    }
}
				
			

Itโ€™s all in one place โ€” HTML + logic = easy life. ๐Ÿ•

And yep โ€” this is a key player in the project structure of ASP.NET Core.

โš™๏ธ appsettings.json

Your appโ€™s config file. Stores settings like logging, connection strings, and more.

				
					{
  "Logging": {
    "LogLevel": {
      "Default": "Information"
    }
  }
}
				
			

Tip: You can add environment-specific versions too like appsettings.Development.json.

๐Ÿš€ Program.cs

This is where your app boots up. No Startup.cs anymore (in .NET 6+). Everything starts here.

Hereโ€™s how a simple one looks:

				
					var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();

app.MapRazorPages(); // Enables Razor Pages

app.Run();
				
			

๐Ÿ’ฅ One file. One purpose. It brings your app to life!

โœจ Recap โ€“ Project Structure of ASP.NET Core

So just to jog your memory:

  • Connected Services/ โ€“ external buddies
  • Dependencies/ โ€“ packages and libraries
  • Properties/ โ€“ launch settings
  • wwwroot/ โ€“ static files
  • Pages/ โ€“ your UI with Razor Pages
  • appsettings.json โ€“ configuration store
  • Program.cs โ€“ where everything starts

Understanding the project structure of ASP.NET Core will make building apps so much smoother. No more guessing. Just confidence. ๐Ÿ’ช

๐Ÿงช Try it Yourself!

Try this in your terminal or VS:

				
					dotnet new webapp -n HelloWebApp
				
			

Then open it up and explore all the folders.
Click, peek, break stuff, laugh, fix it again. Thatโ€™s learning. ๐Ÿ˜„

๐Ÿง  Feeling Confused?

Totally normal! Itโ€™s like moving into a new house โ€” everythingโ€™s unfamiliar at first.
But once you know where the fridge and coffee maker are, youโ€™re good. โ˜•๐Ÿ 

Need a refresher? Scroll up. Or message me anytime. ๐Ÿ’ฌ

ย 

๐Ÿ‘‰ Next What?

Alright, now youโ€™ve mastered the project structure of ASP.NET Core (๐Ÿ‘ high five!).
So whatโ€™s next?

๐Ÿ‘‰ In the next chapter, weโ€™re gonna dive into Building Web Applications using ASP.NET Core.
Yup, real stuff. Real apps. Real fun. ๐Ÿ˜„

Weโ€™ll make things work. Build pages. Add features. You’ll see your code come to life. Canโ€™t wait to show you!

Leave a Comment

Share this Doc

Understanding Project Folders and Files

Or copy link