Skip to content

Display message of criteria when task fails to run due to criteria not being met #3647

@augustoproiete

Description

@augustoproiete

I have something like

Task("UploadTestReport")
    .IsDependentOn("Test")
    .WithCriteria((context) => FileExists(testCoverageOutputFilePath))
    .WithCriteria(!string.IsNullOrWhiteSpace(coverallsRepoToken))
    .WithCriteria((context) => !BuildSystem.IsLocalBuild)
    .Does(() => { }

then my build failed with the message

Error: One or more errors occurred. (Could not reach target 'UploadTestReport' since it was skipped due to a criteria.)
Could not reach target 'UploadTestReport' since it was skipped due to a criteria.
Error: The process 'tools\dotnet-cake' failed with exit code 1

Is there a way how to know what exactly criteria don'twork?

Originally posted by @Marusyk in #3625

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions