An MSBuild logger that outputs build warnings and errors in GitLab Code Quality report format.
- Captures build errors and warnings during
dotnet build - Outputs JSON in GitLab Code Quality format
- Automatic severity mapping:
- Build errors →
critical - CS* (compiler warnings) →
major - CA2*/CA5* (security rules) →
major - CA* (other code analysis) →
minor - IDE*/SA* (style suggestions) →
info - Other warnings →
minor
- Build errors →
- Generates stable fingerprints for issue tracking
- .NET SDK 6.0 or later (for running the tool)
- MSBuild-based project
dotnet new tool-manifest # if you don't have a tool manifest yet
dotnet tool install GitlabCodeQualityBuildLogger.Tooldotnet tool install -g GitlabCodeQualityBuildLogger.Tooldotnet build -logger:"$(dotnet tool run gitlab-code-quality-logger);gl-code-quality-report.json"dotnet build -logger:"$(gitlab-code-quality-logger);gl-code-quality-report.json"build:
stage: build
script:
- dotnet tool restore
- dotnet build -logger:"$(gitlab-code-quality-logger);gl-code-quality-report.json"
artifacts:
reports:
codequality: gl-code-quality-report.jsonThe logger produces JSON compatible with GitLab's Code Quality report format:
[
{
"description": "CS0168: The variable 'x' is declared but never used",
"check_name": "CS0168",
"fingerprint": "A1B2C3D4E5F6...",
"severity": "major",
"location": {
"path": "src/MyClass.cs",
"lines": {
"begin": 42
}
}
}
]GitLab's Code Quality feature provides a great way to track code issues directly in merge requests. However, there was no simple way to integrate .NET build warnings and errors into this workflow. This logger bridges that gap by converting MSBuild output into GitLab's expected format.
I love your input! I want to make contributing to this project as easy and transparent as possible, whether it's:
- Reporting a bug
- Discussing the current state of the configuration
- Submitting a fix
- Proposing new features
- Becoming a maintainer
To get started please read the Contribution Guidelines.
dotnet builddotnet testsrc/
├── DotNet.GitlabCodeQualityBuildLogger/ # Core logger library (netstandard2.1)
└── DotNet.GitlabCodeQualityBuildLogger.Tool/ # CLI tool wrapper (net9.0)
tests/
└── DotNet.GitlabCodeQualityBuildLogger.Tests/ # xUnit tests