A .NET solution following modern best practices and coding standards.
Teck.Cloud/
βββ .config/
β βββ dotnet-tools.json # Local dotnet tool manifest
βββ src/
β βββ Teck.Cloud.Core/ # Core library project
β βββ Models/ # Domain models and result types
β βββ ValueObjects/ # Value objects (e.g., EntityId)
βββ tests/
β βββ Teck.Cloud.Core.Tests/ # Unit tests for Core library
β βββ Models/ # Tests for models
β βββ ValueObjects/ # Tests for value objects
βββ Directory.Build.props # Shared build properties
βββ Directory.Packages.props # Centralized package management
βββ global.json # SDK version control
βββ nuget.config # NuGet package source configuration
βββ Teck.Cloud.sln # Solution file
global.json: Locks the .NET SDK version to ensure consistent builds across environmentsDirectory.Build.props: Defines shared metadata, code quality settings, and build properties for all projectsDirectory.Packages.props: Centralizes NuGet package version management across all projectsnuget.config: Configures package sources and package source mapping
.config/dotnet-tools.json: Manages local dotnet tool dependencies for reproducible builds
- β Nullable reference types enabled
- β Warnings treated as errors
- β Deterministic builds
- β Centralized package management
- β xUnit test framework
- β Code coverage with Coverlet
- β Test isolation and proper fixtures
- β 100% code coverage target
- β Records for immutable data types
- β Value objects to avoid primitive obsession
- β Result types for explicit error handling
- β Functional programming patterns where appropriate
- β Sealed classes by default
- .NET SDK 10.0.100 or later
- Visual Studio 2022 or VS Code with C# extension
dotnet restore
dotnet builddotnet testdotnet test --collect:"XPlat Code Coverage"-
Create the project:
dotnet new classlib -n YourProject -o src/YourProject
-
Add to solution:
dotnet sln add src/YourProject/YourProject.csproj
-
Create corresponding test project:
dotnet new xunit -n YourProject.Tests -o tests/YourProject.Tests dotnet sln add tests/YourProject.Tests/YourProject.Tests.csproj dotnet add tests/YourProject.Tests/YourProject.Tests.csproj reference src/YourProject/YourProject.csproj
-
Add package version to
Directory.Packages.props:<PackageVersion Include="PackageName" Version="1.0.0" />
-
Add package reference to your project (without version):
<PackageReference Include="PackageName" />
-
Restore packages:
dotnet restore
See the .cursor/rules/ directory for detailed coding standards and best practices:
- C# Coding Style: Functional patterns, immutable data, value objects
- Testing Guidelines: xUnit patterns, test isolation, TestContainers for integration tests
- Solution Management: SDK versioning, build properties, package management
- Dependency Management: Security scanning, license compliance, version management