Run a custom command before build

You can use PreBuildSteps and PostBuildSteps string arrays in your *.Target.cs file.

// Specifies a list of steps which should be executed before/after this target is built, in the context of the host platform's shell.
// The following variables will be expanded before execution:
// $(EngineDir), $(ProjectDir), $(TargetName), $(TargetPlatform), $(TargetConfiguration), $(TargetType), $(ProjectFile).

Emphasis on “in the context of the host platform’s shell”.