Created
November 25, 2020 14:19
-
-
Save devlead/41d97860ab2ee8fb2076fb3bc9dccc12 to your computer and use it in GitHub Desktop.
Example use task setup/teardown to modify build state
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BuildData | |
{ | |
public string TaskName { get; set; } | |
} | |
Setup(context => new BuildData()); | |
TaskSetup<BuildData>( | |
(context, data) => data.TaskName = context.Task.Name | |
); | |
TaskTeardown<BuildData>( | |
(context, data) => data.TaskName = null | |
); | |
Task("My Task") | |
.Does<BuildData>( | |
(context, data) | |
=> context.Information("Executing {0}", data.TaskName) | |
); | |
RunTarget("My Task"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment