DoInDirectoryAliases.

DoInDirectory(ICakeContext, DirectoryPath, Action) Method

Summary

Changes the current working directory before an Action and returns to the previous one in the end

Syntax

public static void DoInDirectory(this ICakeContext context, DirectoryPath directory, Action task)

Examples

Use the #addin preprocessor directive

#addin nuget:?package=Cake.DoInDirectory

Cake task:

Task("SomeTask").Does(() =>
{
    DoInDirectory("./SomeDir", () =>
    {
        // Do awesome stuff
    });
});

Attributes

Type Description
CakeMethodAliasAttribute

Parameters

Name Type Description
context ICakeContext The context.
directory DirectoryPath The desired working directory for the action.
task Action The action to be executed.

Return Value

Type Description
void