๐ WAYPOINT LESSON
The .csproj file
โญ beginnerโณ 12 min read๐ Lesson 70 of 85
A project file is data: target framework, project references, and build settings in XML.
Anatomy
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>
- Sdk โ which build toolset owns the file (the modern, convention-based SDK).
- OutputType โ
Exe(console app) or library (the line is absent). - TargetFramework โ the runtime API surface your code compiles against:
net10.0means .NET 10 APIs. - Nullable โ turns nullable-reference-type warnings on.
- ImplicitUsings โ injects the common
usinglines so every file doesn't repeat them.
Source files are discovered by convention: every .cs under the project directory compiles. You never list them.
What beginners touch
Almost nothing at first โ dotnet new console writes a correct file. You'll edit it when you add a dependency (<PackageReference>), reference another project (<ProjectReference>), or flip Nullable.