The dotnet CLI and Project Structure

Dot NET Programming 11 min min read Updated: Nov 16, 2026 Beginner
The dotnet CLI and Project Structure
Beginner Topic 3 of 5

What is in a Project Folder?

text MyFirstApp/ MyFirstApp.csproj the project file (settings and packages) Program.cs your code obj/ temporary build files (do not edit) bin/ the compiled result (do not edit)

The Project File

xml <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>net10.0</TargetFramework> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> </PropertyGroup> </Project>
SettingMeaning
OutputTypeExe means a program you can run. Libraries use Library.
TargetFrameworkWhich .NET version to build for. net10.0 is .NET 10.
ImplicitUsingsCommon using lines such as System and System.Linq are added for you
NullableTurns on compiler help to avoid null errors

Commands You Will Use Daily

CommandWhat it does
dotnet new console -n NameCreate a new console project
dotnet buildCompile the project
dotnet runBuild and run
dotnet watchRe-run automatically whenever you save a file
dotnet testRun unit tests
dotnet publish -c ReleaseCreate the files you deploy
dotnet add package NameAdd a NuGet package
dotnet new --listList all project templates

NuGet: Packages from Other People

NuGet is the package store for .NET. Instead of writing everything yourself, you add a package, for example one that reads CSV files or makes charts.

bash dotnet add package Humanizer dotnet list package dotnet remove package Humanizer

The package name is added to your .csproj as a PackageReference and downloaded automatically.

Solutions: Several Projects Together

A real application usually has several projects, for example a web API, a library with business logic and a test project. A solution (.sln or .slnx) groups them.

bash dotnet new sln -n Shop dotnet new classlib -n Shop.Core dotnet new console -n Shop.App dotnet sln add Shop.Core Shop.App dotnet add Shop.App reference Shop.Core
Tip: Run dotnet build at the solution folder to build everything at once.

Clean Up

bash dotnet clea

If something behaves strangely, delete the bin and obj folders and build again. They are always re-created.

Conclusion

The .csproj describes the project, NuGet gives you ready-made libraries and the dotnet command builds, runs, tests and publishes everything.

Quick Summary: csproj = settings, NuGet = packages, dotnet CLI = build, run, test, publish.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators