Creating Reports

The Cake.Issues.Reporting addin can be used to create issue reports in different formats.

List of all aliases for creating reports

See all available Aliases for creating reports

To create report for issues you need to import the corresponding report format. In the following example the issue provider for reading warnings from MsBuild log files and generic report format is imported:

Example for other report formats

For examples for other formats see Report Format Examples.

build.cake
#addin nuget:?package=Cake.Issues&version=5.5.0
#addin nuget:?package=Cake.Issues.Reporting&version=5.5.0
#addin nuget:?package=Cake.Issues.MsBuild&version=5.5.0
#addin nuget:?package=Cake.Issues.Reporting.Generic&version=5.5.0

Note

In addition to the report format the Cake.Issues and Cake.Issues.Reporting core addins need to be added.

Build.csproj
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net9.0</TargetFramework>
    <RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
    <ImplicitUsings>enable</ImplicitUsings>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Cake.Frosting" Version="5.0.0" />
    <PackageReference Include="Cake.Frosting.Issues.MsBuild" Version="5.5.0" />
    <PackageReference Include="Cake.Frosting.Issues.Reporting.Generic" Version="5.5.0" />
  </ItemGroup>
</Project>

Afterwards you can define a task where you call the reporting addin with the desired issue provider and report format:

build.cake
Task("Create-Report").Does(() =>
{
    var repoRootFolder = new DirectoryPath(@"C:\repo");
    CreateIssueReport(
        MsBuildIssuesFromFilePath(
            @"C:\build\msbuild.log",
            MsBuildBinaryLogFileFormat),
        GenericIssueReportFormatFromEmbeddedTemplate(
            GenericIssueReportTemplate.HtmlDiagnostic),
        repoRootFolder,
        @"c:\report.html");
});
Program.cs
using Cake.Core.IO;
using Cake.Frosting;

public static class Program
{
    public static int Main(string[] args)
    {
        return new CakeHost()
            .Run(args);
    }
}

[TaskName("Create-Report")]
public sealed class CreateReportTask : FrostingTask<FrostingContext>
{
    public override void Run(FrostingContext context)
    {
        var repoRootFolder = new DirectoryPath(@"C:\repo");
        context.CreateIssueReport(
            context.MsBuildIssuesFromFilePath(
                @"C:\build\msbuild.log",
                context.MsBuildBinaryLogFileFormat()),
            context.GenericIssueReportFormatFromEmbeddedTemplate(
                GenericIssueReportTemplate.HtmlDiagnostic),
            repoRootFolder,
            @"c:\report.html");
    }
}