Writing Messages To AppVeyor
To report issues as messages to an AppVeyor build, the AppVeyor addin needs to be imported. For this example the JetBrains InspectCode issue provider is additionally used for reading issues:
build.cake
#addin nuget:?package=Cake.Issues&version=5.2.0
#addin nuget:?package=Cake.Issues.InspectCode&version=5.2.0
#addin nuget:?package=Cake.Issues.PullRequests&version=5.2.0
#addin nuget:?package=Cake.Issues.PullRequests.AppVeyor&version=5.2.0
Note
In addition to the AppVeyor pull request system the Cake.Issues
and Cake.Issues.PullRequests
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.InspectCode" Version="5.2.0" />
<PackageReference Include="Cake.Frosting.Issues.PullRequests.AppVeyor" Version="5.2.0" />
</ItemGroup>
</Project>
This example shows how to report issues as messages to an AppVeyor build using the AppVeyorBuilds alias:
Program.cs
using Cake.Common.IO;
using Cake.Frosting;
public static class Program
{
public static int Main(string[] args)
{
return new CakeHost()
.Run(args);
}
}
[TaskName("Report-IssuesToAppVeyor")]
public sealed class ReportIssuesToAppVeyorTask : FrostingTask<FrostingContext>
{
public override void Run(FrostingContext context)
{
var repoRootPath = context.MakeAbsolute(context.Directory("./"));
context.ReportIssuesToPullRequest(
context.InspectCodeIssuesFromFilePath(
@"C:\build\inspectcode.log"),
context.AppVeyorBuilds(),
repoRootPath);
}
}
The output will look similar to this: