Skip to main content

AppVeyor

Running on AppVeyor will automatically enable custom theming for your build log output:

AppVeyor Log Output

info

Please refer to the official AppVeyor documentation for questions not covered here.

Environment Variables​

You can access predefined environment variables by using the AppVeyor class:

AppVeyor AppVeyor => AppVeyor.Instance;

Target Print => _ => _
.Executes(() =>
{
Log.Information("Branch = {Branch}", AppVeyor.RepositoryBranch);
Log.Information("Commit = {Commit}", AppVeyor.RepositoryCommitSha);
});
Exhaustive list of strongly-typed properties
class AppVeyor
{
string AccountName { get; }
string ApiUrl { get; }
string BuildFolder { get; }
int BuildId { get; }
int BuildNumber { get; }
string BuildVersion { get; }
string BuildWorkerImage { get; }
Tool Cli { get; }
string Configuration { get; }
bool ForcedBuild { get; }
string JobId { get; }
string JobName { get; }
int JobNumber { get; }
string Platform { get; }
int ProjectId { get; }
string ProjectName { get; }
string ProjectSlug { get; }
int? PullRequestNumber { get; }
string PullRequestTitle { get; }
bool Rebuild { get; }
string RepositoryBranch { get; }
string RepositoryCommitAuthor { get; }
string RepositoryCommitAuthorEmail { get; }
string RepositoryCommitMessage { get; }
string RepositoryCommitMessageExtended { get; }
string RepositoryCommitSha { get; }
DateTime RepositoryCommitTimestamp { get; }
string RepositoryName { get; }
string RepositoryProvider { get; }
string RepositoryScm { get; }
bool RepositoryTag { get; }
string RepositoryTagName { get; }
bool ScheduledBuild { get; }
string Url { get; }
}

Configuration Generation​

You can generate build pipeline files from your existing target definitions by adding the AppVeyor attribute. For instance, you can run the Compile target on every push with the latest Ubuntu image:

Build.cs
[AppVeyor(
AppVeyorImage.VisualStudio2022,
InvokedTargets = new[] { nameof(Compile) })]
class Build : NukeBuild { /* ... */ }
Generated output
appveyor.yml

image:
- Visual Studio 2022

build_script:
- cmd: .\build.cmd Compile
- sh: ./build.cmd Compile
info

Whenever you make changes to the attribute, you have to run the build at least once to regenerate the pipelines file.

Artifacts​

If your targets produce artifacts, like packages or coverage reports, you can publish those directly from the target definition:

Target Pack => _ => _
.Produces(PackagesDirectory / "*.nupkg")
.Executes(() => { /* Implementation */ });
Generated output
appveyor.yml
artifacts:
- path: output/packages/*.nupkg

After your build has finished, those artifacts will be listed under the artifacts tab:

AppVeyor Artifacts Tab