Reputation: 199
I'm using VSO to create an automated build for a newly created ASP.NET 5 project. I followed the MSDN post and with a couple of tweaks, the following items work:
What I'm trying to do is create a build agent on my laptop. I downloaded the agent.zip file and ran the powershell configuration script. When I queue the first build, VSO contacts my build agent and the build works and is published to Azure.
What does not work is the second time I queue a build. The build fails executing the following command:
Get-ChildItem -Path $PSScriptRoot\src -Filter project.json -Recurse | ForEach-Object { & echo $_.FullName }
The error is:
2016-02-09T17:13:50.1055064Z C:\agent\_work\1\s\MyMeds\src\MyMeds\project.json
2016-02-09T17:13:50.4535551Z ##[error]Get-ChildItem : The specified path, file name, or both are too long. The fully qualified file name must be less than
2016-02-09T17:13:50.4535551Z ##[error]260 characters, and the directory name must be less than 248 characters.
2016-02-09T17:13:50.4535551Z ##[error]At C:\agent_work\1\s\MyMeds\Prebuild.ps1:28 char:1
I would have guessed the work area would have been cleared out before the build started, but it does not seem to be the case. Also, if I manually clear the _work directory, the build succeeds. I've tried to clear the work are from within the PowerShell script, but this fails because the script is running in that directory.
Any suggestions of how to clear the work directory so that multiple builds will succeed ?
Upvotes: 0
Views: 131
Reputation: 29976
This is caused by the npm install command in the "PrePublish" script and the npm version used by VS.
"scripts": {
"prepublish": [ "npm install npm@latest", "npm version", "npm install", "bower install", "gulp clean", "gulp min" ]
}
Windows MAXPATH is limited to 260 characters while the old npm version does not apply this. The latest npm 3.x version has fixed this issue. But VS always use 1.4.9 version which cause the long path issue. See this issue for details: Update node to 5.x and npm to 3.x
The workaround for now would be remove the prepublish script from your project.json file and add additional steps in your build definition to perform these actions.
Upvotes: 1