【发布时间】:2015-05-18 15:37:29
【问题描述】:
我正在尝试将 MSBuild 转换为 psake。
我的存储库结构如下所示:
.build
| buildscript.ps1
.tools
packages
MyProject
MyProject.Testing
MyProject.sln
我想在构建之前清理存储库(使用 git clean -xdf)。 但我找不到设置 git 执行目录的方法(期望使用 .Net 类)。
首先我搜索了一种在 psakes exec 中设置工作目录的方法:
exec { git clean -xdf }
exec { Set-Location $root
git clean -xdf }
Set-Location 有效,但在 exec 块完成后,位置仍设置为 $root。
然后我尝试了:
Start-Process git -Argumentlist "clean -xdf" -WorkingDirectory $root
这有效,但保持 git 处于打开状态,并且不会执行未来的任务。
如何在 $root 中执行 git?
【问题讨论】:
标签: powershell working-directory psake