Search code examples
tfsmsbuildnpmbuild-definition

pre-build script path not logging output


I have a pre-build PowerShell script defined in my Build Definition. The PowerShell script execute a program:

& "c:\Program Files\nodejs\npm.cmd" "run" "build"

When npm runs, npm writes things to stdout/console. This output doesn't show up in my logs for the build though.

What do I need to do to make sure the build logs capture this console output?

In other words, is there something I can add to & "c:\Program Files\nodejs\npm.cmd" "run" "build" that will pipe the output to the build log?

EDIT:

I think it's one of these three but not sure which:

& "c:\Program Files\nodejs\npm.cmd" "run" "build-release" 2>&1 | Out-Host
& "c:\Program Files\nodejs\npm.cmd" "run" "build-release" 2>&1 | Write-Host
& "c:\Program Files\nodejs\npm.cmd" "run" "build-release" 2>&1 | Write-Output

Solution

  • If you set logging to verbose it will log everything...

    I normally add a -Verbose at the end of every line