I’m trying to move form MSBuild to psake.
My repository structure looks like this:
.build
| buildscript.ps1
.tools
packages
MyProject
MyProject.Testing
MyProject.sln
I want to clean the repository before building (using git clean -xdf). But I can’t find a way (expect with the .Net classes) to set the execution directory of git.
First I searched for a way to set the working directory in psakes exec:
exec { git clean -xdf }
exec { Set-Location $root
git clean -xdf }
Set-Location works but after the exec block is finished the location is still set to $root.
Then I tried:
Start-Process git -Argumentlist "clean -xdf" -WorkingDirectory $root
Which works but keeps git open and no future task gets executed.
How can I execute git in $root?