Project structure and assemblies
Solution file (.sln)
A solution file is a container that groups one or more related projects. Visual Studio and other IDEs use it to manage those projects as a single unit.
Project file (.csproj)
For C# projects, the .csproj file is an XML-based MSBuild file that defines project-specific settings:
- the target framework or frameworks, for example
<TargetFramework>net8.0</TargetFramework> - the output type: library, console app, web app
- package references (NuGet dependencies, via
<PackageReference>) - project references (
<ProjectReference>) - instructions for how files are handled during the build, such as
Compile,ContentandEmbeddedResource
A deep understanding of the .csproj format is vital for customizing builds, managing complex dependencies, and troubleshooting build issues.
Output folders: obj/ and bin/
obj/holds the intermediate object files and other temporary files the compiler generates during the build.bin/holds the final compiled output of the project: assemblies (DLLs or EXEs), dependency DLLs, and any content files marked for publishing. The exact path often includes the build configuration (such as Debug or Release) and the target framework moniker (such asnet8.0).
global.json
This optional file can be used at the solution level to specify which version of the .NET SDK to use if multiple versions are installed.
Typical folder layout
A common convention for organizing .NET solutions has a src directory for source code projects, a tests directory for test projects, an artifacts directory for build outputs (like NuGet packages), a docs directory for documentation, and optionally a samples directory.
Assemblies
Compiled CIL code, along with its metadata, is packaged into assemblies. Assemblies are the fundamental units of deployment, versioning, reuse, activation scoping and security permissions for .NET applications. They can be executable files (.exe) or library files (.dll). Each assembly contains a manifest that describes the assembly itself (name, version, culture, public key token if strong-named) and lists all the types and resources it contains.
The compilation that produces them is in the first note of this trailThe CLI, the CLR and compilationWhat .NET is built on, and how C# source becomes running code.Opens in a new tab.
Sources
- .NET Framework, Wikipedia · accessed May 16, 2025
- .NET project structure, GitHub Gist · accessed May 16, 2025