I’ve written a small powershell script that compiles all my typescript files and then bundles them. It works just fine when I run the script from within the powershell editor, but when I try to run it as a post-build event, the build just hangs.
As soon as I remove the bundler line from the script, the build works (ie: it compiles the ts files)
What would cause this behavior?
$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"
Turns out I need to figure out a different way of getting the solution directory in PowerShell.
My ps script uses
$(get-location)to get the current directory.This works fine when running from the script editor since my script is located in the root of the solution, HOWEVER, This does NOT work fine in a post-build since the “new” current directory is located in the
binfolder.My current work-around is to use absolute paths.