Lesson 5 of 62Beginner11 min
Understanding Project Structure
By the end of this lesson
Read a .csproj file and explain what the build output folders contain.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>- OutputType Exe means this produces a runnable program rather than a library.
- TargetFramework is the .NET version you are building against.
- ImplicitUsings adds common namespaces automatically, which is why you can use Console without writing using System;.
- Nullable enable turns on null-safety warnings — covered properly in the modern C# module, and worth leaving on.
Folders that appear after you build:
- bin
- The build output — the compiled application and everything it needs to run. This is what gets deployed.
- obj
- Intermediate files used during the build, including dependency resolution results. Working scratch space.
Adding a dependency
dotnet add package Newtonsoft.Json- This downloads the package and records it in the .csproj file as a PackageReference.
- Because it is recorded in the project file, anyone who clones the repository gets the same dependency on their next build. You never commit the package itself.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
</Project>Summary
- The .csproj file declares the target framework, output type and dependencies
- bin holds deployable build output; obj holds intermediate build files
- Neither belongs in version control
- dotnet add package records a dependency in the project file, which is what makes builds reproducible
Saved in this browser only.