$ dotnet restore$ dotnet build$ dotnet run{"Text":"Hello, NuGet!"}# you edit Program.cs$ dotnet pack Greeter# Greeter.1.0.0.nupkgup to dateGreeter~/.nuget/packagesnewtonsoft.json/13.0.3.nupkg unpackednetstandard2.0net6.013.0.213.0.313.0.4nuget.org1<Project Sdk="Microsoft.NET.Sdk">2 …3 <ProjectReference Include=4 "../Greeter/Greeter.csproj" />5 <PackageReference6 Include="Newtonsoft.Json"7 Version="13.0.3" />8 …9</Project>MSBuildApp/bin/Debug/net8.0/App.dllGreeter.dllNewtonsoft.Json.dll13.0.3App.dllGreeter.dllJson.dll{…}1.0.0
Back row: terminal, Greeter project, packages folder, nuget.orgFront row: App.csproj, MSBuild, the app's bin folderTokens: the package, source, DLLs, the output and Greeter.1.0.0.nupkg movingBack row: the terminal, the Greeter library project, the global packages folder and the feed nuget.org. Front row: the App.csproj project file, MSBuild and the output folder App/bin/Debug/net8.0/ Restore brings Newtonsoft.Json 13.0.3 from nuget.org into ~/.nuget/packages; build compiles Greeter, then App, and gathers three DLLs in bin; the app prints {"Text":"Hello, NuGet!"}. The App.csproj card leaves out the PropertyGroup (OutputType Exe, TargetFramework net8.0) and the ItemGroup tags (the "…" lines); the step text shows the whole file. Splitting a tag over lines is ordinary XML.

The project file

  1. A .NET project is a folder with a project file, here App.csproj. It is XML for MSBuild, the .NET build engine. Sdk="Microsoft.NET.Sdk" brings in the standard build steps, and every .cs file in the folder is compiled.

Restore: NuGet packages

Build and run

Rebuild and share

What happens

// step 1/10 · project-file
App/App.csproj   (the whole file)
  <Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
      <OutputType>Exe</OutputType>
      <TargetFramework>net8.0</TargetFramework>
    </PropertyGroup>
    <ItemGroup>
      <ProjectReference Include=
        "../Greeter/Greeter.csproj" />
      <PackageReference
        Include="Newtonsoft.Json"
        Version="13.0.3" />
    </ItemGroup>
  </Project>
App/Program.cs   compiled automatically (every **/*.cs)

The App.csproj card leaves out the PropertyGroup (OutputType Exe, TargetFramework net8.0) and the ItemGroup tags (the "…" lines); the step text shows the whole file. Splitting a tag over lines is ordinary XML. Skipping is per MSBuild target: the C# compile target (CoreCompile) runs only when an input file is newer than its outputs. Greeter is still visited but does no compiling. The .NET SDK also builds reference assemblies, so a change inside a Greeter method body may not even make App recompile.