Bundler在Powershell中工作,但不在post build事件中工作

时间:2012-12-11 06:53:52

标签: javascript servicestack

我写了一个小的PowerShell脚本,它编译了我的所有打字稿文件,然后捆绑它们。当我从powershell编辑器中运行脚本时,它工作正常,但是当我尝试将其作为构建后事件运行时,构建就会挂起。

一旦从脚本中删除了捆绑行,构建就会起作用(即:它编译ts文件)

什么会导致这种行为?

$TypeScripts = get-childitem "$(get-location)\RockyMountainArts.Web\scripts\src\*\*.ts" -recurse

foreach ($tsFile in $TypeScripts){
    tsc $tsFile
}

&"$(get-location)\RockyMountainArts.Web\bundler\node.exe" "$(get-location)\RockyMountainArts.Web\bundler\bundler.js" "$(get-location)\RockyMountainArts.Web\CSS" "$(get-location)\RockyMountainArts.Web\Scripts"

1 个答案:

答案 0 :(得分:1)

事实证明,我需要找到一种在PowerShell中获取解决方案目录的不同方法。

我的ps脚本使用$(get-location)来获取当前目录。

这从脚本编辑器运行时工作正常,因为我的脚本位于解决方案的根目录中,但是,由于“new”当前目录位于{{1}中,因此在后期构建中不能正常工作文件夹。

我目前的解决方法是使用绝对路径。