Skip to content

Security: DriveOxCorrect/csharp-class-library-framework

Security

SECURITY.md

Csharp Class Library Framework

Header

Version Downloads License Platform


🏗️ The Foundation Of Modern .NET Architecture

Every great .NET application—whether it's a high-frequency trading platform, an enterprise ERP, or a mobile game—is built on a solid foundation of reusable class libraries. However, designing a library that is easy to maintain, test, version, and distribute is an art form. Csharp Class Library Framework is a production-ready, opinionated template designed to eliminate the boilerplate and enforce best practices from day one.

This repository is not just a starting point; it is a complete architectural blueprint. It provides a structured solution template with pre-configured projects for the core library, unit tests, integration tests, benchmarks, and NuGet packaging. It enforces strict coding standards, dependency injection, and clean architecture principles, ensuring your code remains maintainable as it scales.

Whether you are a solo developer publishing open-source utilities or part of an enterprise team building internal SDKs, this framework saves you weeks of setup time. It includes continuous integration pipelines for GitHub Actions, automated semantic versioning, and a beautiful documentation site generated via DocFX.

1616320355636

🧱 The Anatomy Of A Perfect Library

We have structured the solution to follow the Onion Architecture, ensuring your business logic is isolated from external dependencies. Here is how the projects are organized:

1. The Core Domain (MyLibrary.Core)

This is the heart of your library. It contains the interfaces, domain models, and business logic. It has zero external dependencies, making it incredibly fast to test and easy to port. It defines the contracts that the rest of the application will implement.

2. The Infrastructure Layer (MyLibrary.Infrastructure)

This project contains the concrete implementations of the interfaces defined in the Core. For example, if your Core defines an IEmailService, the Infrastructure project contains the SmtpEmailService. This separation allows you to swap out implementations without touching the core logic.

3. The Testing Suite (MyLibrary.Tests)

We provide a comprehensive testing setup using xUnit and Moq. It includes unit tests for the core logic, integration tests for the infrastructure, and mutation tests using Stryker.NET to ensure your tests are actually catching bugs.

4. The Benchmark Suite (MyLibrary.Benchmarks)

Performance matters. This project uses BenchmarkDotNet to measure the execution time and memory allocation of your critical methods. It generates beautiful, statistically rigorous reports so you can prove your library is fast.

5. The NuGet Package (MyLibrary.Package)

We provide a pre-configured .csproj file with all the metadata required for NuGet publishing. It includes a custom icon, README embedding, and SourceLink support, ensuring your package looks professional on NuGet.org.


🔗 Ready to build your library?

Get Framework


⚙️ Automated DevOps Pipeline

We believe that deployment should be as simple as pushing code. The framework includes a fully configured GitHub Actions workflow.

Stage Description
Build Restores dependencies and builds the solution in Release mode
Test Runs all unit and integration tests with code coverage reporting
Benchmark Runs performance benchmarks and detects regressions
Package Automatically versions and packages the library as a .nupkg
Publish Pushes the package to NuGet.org when a new tag is created

🧠 Under The Hood: Why Source Generators?

This framework includes support for C# Source Generators. Source Generators are a compiler feature that allows you to inspect your code and generate additional C# files on the fly.

We use this to automatically generate boilerplate code. For example, if you decorate a class with [AutoImplement], the source generator automatically creates the INotifyPropertyChanged implementation for all your properties. This eliminates hundreds of lines of tedious code while maintaining full compile-time safety. We also provide a template for creating your own source generators, allowing you to automate your own repetitive patterns.


⚙️ Need a detailed configuration guide?

Setup Guide


🛠️ Tech Stack

C# .NET xUnit GitHub Actions NuGet Git


🤝 Community & Contributing

We believe that great libraries are built by communities, not individuals. If you have suggestions for improving the architecture, found a bug in the pipeline, or want to add support for a new testing framework, we welcome your contributions!

  1. Fork the repository.
  2. Create your feature branch (git checkout -b feature/new-generator).
  3. Commit your changes (git commit -m 'Add new source generator').
  4. Push to the branch (git push origin feature/new-generator).
  5. Open a Pull Request.

Please read our CONTRIBUTING.md for detailed coding standards and testing requirements. We also have an active Discord server where you can share your libraries, ask for help with NuGet publishing, and discuss the latest trends in .NET development.


📬 Contact & Support

  • 💬 Discussions: Join the conversation in the GitHub Discussions tab.
  • 🐛 Issues: Found a bug? Let us know via the Issues tracker.
  • 📧 Email: Reach out directly at support@csharp-library.dev.

⭐ If this framework accelerates your development, give it a star! ⭐

Star


🚀 Start building your library today

Get Started

Crafted with precision and ❤️ by the Csharp Class Library Framework community

Footer

There aren't any published security advisories