- Add BuildCrossCheck service token as an environment variable named
BCC_TOKEN - Add the nuget package
BCC-MSBuildto a project in your soution. - Integrate into your build by adding the msbuild logger
msbuild [Solution] -logger:packages\BCC-MSBuildLog.1.0.0\tools\net472\BCCMSBuildLog.dll
Depending on your project configuration, nuget packages may be located centrall on the machine at %userprofile%\.nuget\packages.
Additional parameters can be passed to an msbuild logger in the logger option.
For ex: -logger:packages\BCC-MSBuildLog.1.0.0\tools\net472\BCCMSBuildLog.dll;configuration=bcc-config.json
| Argument | Description |
|---|---|
| configuration | Path to configuration file |
| token | BuildCrossCheck service token (if not using environment variable) |
On supported CI build systems, BuildCrossCheck will grab all required information about GitHub and your repo from the build environment.
- AppVeyor
- Cirlce
- Jenkins
- Travis
On other CI build systems, the following arguments should be provided in the msbuild command
| Argument | Description |
|---|---|
| cloneRoot | Path where build occurred |
| owner | Owner |
| repo | Repository name |
| hash | Hash of the current commit |
The configuration file is a json document that allows customization of the Check Run output.
Here we are taking CS0219 which is normally a warning and forcing it to be reported as an error. If used in combination with branch protection settings, this could be used to prevent a Pull Request from being merged.
{
'rules': [
{
'code': 'CS0219',
'reportAs': 'error'
}
]
}
CheckRunConfiguration src
- rules (array[LogAnalyzerRule]) - Array of rules
- name (string)
LogAnalyzerRule src
- code (string, required) - The MSBuild warning/error code to match against
- reportAs: asIs, ignore, notice, warning, error (enum, required)