TFS 构建系统中 Powershell 脚本中的工作文件夹问题

Working folder issue in Powershell script in TFS build system

我在 Visual Studio 团队服务(Visual Studio 在线)构建中设置了一个构建定义。

下面是 Powershell 脚本设置的快照:

我没有在 'Working folder' 中设置任何内容,因为我假设它默认为信息中指定的脚本所在的文件夹。

构建运行时,它会在 Powershell 步骤抛出异常。

错误截图如下:

不知何故工作文件夹不是脚本所在的文件夹。 有什么修复建议吗?

使用 powershell 变量 $PSScriptRoot 获取脚本所在的目录,并使用它找出所有其他路径。