kgen.Analyzers.Repository
1.0.9
Prefix Reserved
dotnet tool install --global kgen.Analyzers.Repository --version 1.0.9
dotnet new tool-manifest
dotnet tool install --local kgen.Analyzers.Repository --version 1.0.9
#tool dotnet:?package=kgen.Analyzers.Repository&version=1.0.9
nuke :add-package kgen.Analyzers.Repository --version 1.0.9
Analyzers.Repository
Analyzers.Repository is a code quality tool that scans your .NET repository and identifies common configuration issues. It checks for problems with project structure, dependencies, copyright notices, and build configuration best practices.
What Does It Check?
The tool runs multiple analyzers on your repository:
- Directory Structure (KG001-KG002): Validates proper directory configuration
- Dependency Management (KG003): Recommends using
Directory.Packages.propsfor centralized package version management - Build Configuration (KG004): Identifies duplicate properties between
Directory.Build.propsand individual.csprojfiles - Build Configuration (KG004, KG007, KG008): Identifies duplicate properties between
Directory.Build.propsand individual.csprojfiles; ensures splitDirectory.Build.*.props/.targetsare imported by the mainDirectory.Build.props(KG007); requiresDirectory.Build.Analyzers.propswhen a rootDirectory.Build.propsexists (KG008) - Copyright Year (KG005): Ensures copyright headers in files include the current year
- Solution File Format (KG006): Validates solution file format preferences
Getting Started
Run a Scan
The easiest way to use the tool is to run it directly without installing:
# Scan your current directory
dotnet tool exec kgen.analyzers.repository -d .
# Scan a specific directory
dotnet tool exec kgen.analyzers.repository -d /path/to/repo
# Exclude certain folders from the scan
dotnet tool exec kgen.analyzers.repository -d . -e "bin/**" -e "obj/**"
This approach always runs the latest version of the tool.
Install the Tool (Optional)
If you prefer to install the tool globally:
dotnet tool install --global kgen.analyzers.repository
Command-Line Options
-d, --directory <dir>: Directory to scan (default: current directory)-e, --exclude <pattern>: Patterns to exclude from the scan (minimatch-style). Can be repeated multiple times.
Understanding the Results
When the tool finds issues, it will display them with:
- An error code (e.g., KG003) - use this to look up specific rules
- A severity level (Error or Warning)
- A description of the issue
- The file path and location where the issue was found
Suppressing Rules
If you want to ignore specific checks, you can disable them by passing rule codes. Refer to the documentation links provided with each error for more information about what each rule means and how to fix it.
Reporting Issues
Found a bug or have suggestions? Please open an issue on GitHub. When reporting:
- Include the error code (KG###) from the output
- Describe what you expected vs. what you got
- Share the relevant command you ran
- If possible, include a minimal example of your repository structure that reproduces the issue
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.