0

I've created a build definition in Visual Studio Team Services with a hosted agent, and I'm trying to build an Angular 4 project via an npm task, but when I use a Copy File or Publish Artifact task, the places I look for output are always empty. The npm task looks like this:

Version: 1.*
Command: custom
Working folder with package.json: $/teamproj/soln/proj
Command and arguments: run vsts-build-dev -op $(BuildArtifactStagingDirectory)\wwwroot

I've tried controlling the output and retrieving the compiled code via a number of methods...the npm step usually completes, but I'm never able to find the output. Currently I have a custom function called "vsts-build-dev" which just runs "ng build -dev". I wasn't sure whether I could build directly to a subfolder of the BuildArtifactStagingDirectory...the npm task works, but a later zip of the build files is empty.

The logs don't always give the full picture of where the files are being generated and I've found debugging these tedious as they're always taking 6-10 minutes before failing...what's the best way to troubleshoot file paths with a hosted agent?

1 Answer 1

2

The syntax is: npm run <command> [-- <args>]

For example, Command and arguments: run vsts-build-dev -- -op ..\a\wwwroot. (can’t use build variable, using relative path instead)

Sign up to request clarification or add additional context in comments.

3 Comments

I tried this and it didn't work, the BuildArtifactStagingDirectory is still empty...is the output path relative to the npm runtime, or the working directory that's being compiled (which is something like d:\a\4\s\teamproj\soln\proj)?
It is related to the project.json path, so using run vsts-build-dev -- -op ..\..\..\..\a\wwwroot
Yes, actually the underlying problem was also related to a hard-coded -outdir argument in the .angular-cli.json file which was overriding this, but your solution helped me get there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.