How martincostello/dotnet-8-samples works
Project type and purpose
• This repository is a collection of .NET 8 sample applications and libraries used to demonstrate new language features (C# 12) and platform capabilities (TimeProvider abstraction, ASP.NET Core Weather API).
• There is no single “production” system here; instead, we have three self-contained samples:
• CSharp12 – a console app showcasing C# 12 syntax samples
• TimeProvider – a class library plus its xUnit test project (TimeProvider.Tests)
• WeatherApi – an ASP.NET Core Web API sample illustrating HTTP clients, configuration, and launch profiles
File structure
• Top-level security & configuration:
• global.json – pins .NET SDK to version 8
• Directory.Build.* and Directory.Packages.props – centralize MSBuild settings and NuGet versions
• build.ps1 – orchestrates a full solution build via MSBuild/dotnet CLI
• src folder: three sub-projects, each with its own .csproj
• CSharp12 (console)
• TimeProvider (class library)
• WeatherApi (ASP.NET Core web API) with appsettings.json and launchSettings.json for local debugging
• tests folder: TimeProvider.Tests – an xUnit test project referencing TimeProvider
• .github/workflows/build.yml – CI pipeline that restores, builds, tests
README for additional insights
• Confirms this is a samples repo for a .NET 8 talk.
• Instructs how to clone & build via build.ps1.
• Mentions no production deployment; the focus is on code samples.
a. Main components
1. Solution build orchestrator (build.ps1 / dotnet CLI / GitHub Actions)
2. CSharp12 console application
3. TimeProvider class library
4. TimeProvider.Tests (xUnit test suite)
5. WeatherApi ASP.NET Core Web API
6. External Weather HTTP endpoint (represented by forecast.http sample)
b. Relationships & interactions
• The solution file (.sln) ties together all three projects.
• build.ps1 (and GitHub Actions) invokes dotnet restore/build/test on the solution.
• TimeProvider.Tests references TimeProvider → run under test runner.
• WeatherApi at runtime reads appsettings.json, uses HttpClient to call external weather API (forecast.http).
• global.json ensures all projects build on .NET 8 SDK.
c. Architectural patterns & principles
• Separation of concerns: console app / library / web API / tests are all isolated projects
• Centralized configuration: Directory.Build.props for MSBuild settings, appsettings.json for runtime config
• Conventional layering: Library (TimeProvider) sits under test harness; Web API is a thin wrapper calling external services
d. Key technologies & frameworks
• .NET 8 SDK & SDK-style csproj
• MSBuild central props/targets
• xUnit for unit tests
• ASP.NET Core Web API
• JSON-based configuration (appsettings.json, httpenv.json)
• GitHub Actions for CI (build.yml)
Essential detail callouts
• Appsettings.json & launchSettings.json under WeatherApi.
• That CSharp12 is purely illustrative (no external dependencies).