ExxerRules 1.0.3
dotnet add package ExxerRules --version 1.0.3
NuGet\Install-Package ExxerRules -Version 1.0.3
<PackageReference Include="ExxerRules" Version="1.0.3"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="ExxerRules" Version="1.0.3" />
<PackageReference Include="ExxerRules"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add ExxerRules --version 1.0.3
#r "nuget: ExxerRules, 1.0.3"
#:package ExxerRules@1.0.3
#addin nuget:?package=ExxerRules&version=1.0.3
#tool nuget:?package=ExxerRules&version=1.0.3
ExxerRules - Modern Development Conventions
ExxerRules is a comprehensive suite of 20 production-ready Roslyn analyzers that enforce Modern Development Conventions (MDC) for C# projects. No IDE extensions required - works everywhere .NET works.
๐ Quick Start
Installation
# Package Manager Console
Install-Package ExxerRules
# .NET CLI
dotnet add package ExxerRules
# PackageReference
<PackageReference Include="ExxerRules" Version="1.0.0" PrivateAssets="all" />
Zero Configuration
Works out-of-the-box! The analyzers activate automatically and start improving your code quality immediately.
๐ฆ What's Included
๐๏ธ Architecture (2 analyzers)
- ER1001: Domain Should Not Reference Infrastructure
- ER1002: Use Repository Pattern
โก Async Best Practices (2 analyzers)
- ER2001: Async Methods Should Accept CancellationToken
- ER2002: Use ConfigureAwait(false)
๐ก๏ธ Error Handling (2 analyzers)
- ER6001: Avoid Throwing Exceptions
- ER6002: Use Result<T> Pattern
๐งช Modern Testing (5 analyzers)
- ER12001: Do Not Mock DbContext
- ER12002: Do Not Use FluentAssertions (use Shouldly)
- ER12003: Do Not Use Moq (use NSubstitute)
- ER12004: Test Naming Convention
- ER12005: Use xUnit v3
โก Performance (1 analyzer)
- ER11001: Use Efficient LINQ
โจ Modern C# (2 analyzers)
- ER9001: Use Expression-Bodied Members
- ER9002: Use Modern Pattern Matching
๐ Code Quality (2 analyzers)
- ER4001: Avoid Magic Numbers and Strings
- ER4002: Do Not Use Regions
๐ Documentation (1 analyzer)
- ER5001: Public Members Should Have XML Documentation
๐ Logging (2 analyzers)
- ER8001: Do Not Use Console.WriteLine
- ER8002: Use Structured Logging
๐ก๏ธ Null Safety (1 analyzer)
- ER10001: Validate Null Parameters
๐ Functional Patterns (1 analyzer)
- ER7001: Do Not Throw Exceptions in Functional Code
๐จ Code Formatting (2 analyzers)
- ER3001: Code Formatting Standards
- ER3002: Project Formatting Standards
โ๏ธ Configuration
Basic Configuration
Add to your .csproj
file:
<PropertyGroup>
<ExxerRulesEnabled>true</ExxerRulesEnabled>
<ExxerRulesSeverity>warning</ExxerRulesSeverity>
</PropertyGroup>
Advanced Configuration
Enable/disable specific categories:
<PropertyGroup>
<ExxerRulesArchitecture>true</ExxerRulesArchitecture>
<ExxerRulesAsync>true</ExxerRulesAsync>
<ExxerRulesErrorHandling>true</ExxerRulesErrorHandling>
<ExxerRulesTesting>true</ExxerRulesTesting>
<ExxerRulesPerformance>true</ExxerRulesPerformance>
<ExxerRulesModernCSharp>true</ExxerRulesModernCSharp>
<ExxerRulesCodeQuality>true</ExxerRulesCodeQuality>
<ExxerRulesDocumentation>false</ExxerRulesDocumentation>
<ExxerRulesLogging>true</ExxerRulesLogging>
<ExxerRulesNullSafety>true</ExxerRulesNullSafety>
<ExxerRulesFunctionalPatterns>true</ExxerRulesFunctionalPatterns>
<ExxerRulesCodeFormatting>true</ExxerRulesCodeFormatting>
</PropertyGroup>
Directory.Build.props Integration
Apply to all projects in your solution:
<Project>
<PropertyGroup>
<ExxerRulesEnabled>true</ExxerRulesEnabled>
<ExxerRulesSeverity>warning</ExxerRulesSeverity>
<ExxerRulesDocumentation Condition="$(MSBuildProjectName.Contains('Test'))">false</ExxerRulesDocumentation>
</PropertyGroup>
</Project>
๐ฏ Modern Development Conventions
โ Recommended Patterns
- Result<T> for error handling instead of exceptions
- Repository Pattern for data access abstraction
- xUnit v3 with NSubstitute and Shouldly for testing
- CancellationToken for async operations
- ConfigureAwait(false) for library code
- Structured logging with ILogger<T>
โ Anti-Patterns Detected
- Exception throwing for control flow
- Direct infrastructure references from domain
- Magic numbers and strings
- Console.WriteLine for logging
- Legacy test frameworks (MSTest, NUnit)
- FluentAssertions and Moq (replaced by better alternatives)
๐ ๏ธ CI/CD Integration
Works seamlessly in build pipelines:
# Azure DevOps
- task: DotNetCoreCLI@2
displayName: 'Build with ExxerRules'
inputs:
command: 'build'
projects: '**/*.csproj'
arguments: '--configuration Release --verbosity normal'
# GitHub Actions
- name: Build with ExxerRules
run: dotnet build --configuration Release --verbosity normal
๐ Requirements
- .NET Standard 2.0 or higher
- C# 7.0 or higher
- Works with:
- Visual Studio 2019/2022
- Visual Studio Code (with C# extension)
- JetBrains Rider
- Command line builds
- CI/CD systems
๐ Benefits
- Zero Setup - Install and go
- Consistent Quality - Same rules across team and CI/CD
- Gradual Adoption - Enable categories incrementally
- Performance - Fast analysis with minimal impact
- Modern Standards - Based on current C# best practices
- Open Source - MIT licensed, community driven
๐ License
Licensed under the MIT License.
๐ Links
- GitHub: https://github.com/exxerai/exxer-rules
- Issues: https://github.com/exxerai/exxer-rules/issues
- NuGet: https://www.nuget.org/packages/ExxerRules/
Built with โค๏ธ by the ExxerAI Team
Making C# development more reliable, maintainable, and performant - everywhere.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.