Lesson 3 / 26
Inside a Project Folder
Read a .csproj and Program.cs and know what bin and obj hold.
The .csproj file
The .csproj is a small XML file describing the project: target framework, output type and NuGet packages. You rarely list source files; everything under the folder is included.
A minimal project file
Nullable turns on null-safety warnings and ImplicitUsings adds common using lines for you.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>Never commit bin and obj
bin/ holds build output and obj/ holds intermediate files. Both are regenerated, so add them to .gitignore. dotnet new gitignore creates a ready-made file.
Quick check: What does the obj folder contain?
- Your hand-written source code
- Intermediate build files
- User settings secrets
- Database migrations
Answer
Intermediate build files — It holds generated intermediate files and restore results, safe to delete and regenerate.