Whetstone.
C# for a TypeScript developerSolutions, projects, and packages
Module 1 · Lesson 411 min

Solutions, projects, and packages

Start with the shapes. A solution (.sln) is a collection of projects. A project (.csproj) is one compiled unit: it produces a DLL and declares its own dependencies and settings. In Node terms, a project is roughly a package, and the solution is the workspace that ties them together.

The Fusion backend is one solution with several projects that stack into layers: domain, application, persistence, presentation/api, and tests. Each is a .csproj. A project references another project explicitly, and the compiler enforces the direction: domain depends on nothing, application depends on domain, and so on. That reference graph is the architecture, made physical.

The .csproj is where package.json and tsconfig.json merge into one file. It sets the target framework, language options, and every NuGet package (the npm of .NET). Here’s the real Fusion domain project.

domain/Fusion.Domain.csproj (real)
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net10.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Ardalis.SmartEnum" Version="8.2.0" />
  </ItemGroup>
</Project>
Practice

Try it yourself

Do

Walk the project graph

Get oriented in a real multi-project solution before you touch any code.

  • In ~/focused/launchpad/apps/fusion-backend, run ls and note the layer folders: domain, application, persistence, presentation, tests
  • Open domain/Fusion.Domain.csproj and application/Fusion.Application.csproj and compare their PackageReference and ProjectReference lines
  • Confirm application references domain but domain references no other project
Done whenYou can name the five projects and state that dependencies point inward: domain depends on nothing, application depends on domain.
Recall

What the .csproj is

Anchor the mapping.

A TS colleague asks what a .csproj file is in terms they'd know. What do you say?

Reveal answer

It's package.json and tsconfig.json combined for one project: it sets the target framework and language options (like tsconfig) and lists the NuGet dependencies (like package.json dependencies). The .sln above it is the workspace.

Sign in to track your progress →