简体   繁体   English

VSO上的ASP.net 5第二次运行时,构建代理失败

[英]Build agent fails on second run for ASP.net 5 on VSO

I'm using VSO to create an automated build for a newly created ASP.NET 5 project. 我正在使用VSO为新创建的ASP.NET 5项目创建自动生成。 I followed the MSDN post and with a couple of tweaks, the following items work: 我关注了MSDN的帖子,并进行了一些调整,以下各项起作用:

  1. Automated build and deploy of ASP.NET project in VSO 在VSO中自动构建和部署ASP.NET项目
  2. Build and deploy of ASP.NET project from my laptop using VS 2015 使用VS 2015从我的笔记本电脑构建和部署ASP.NET项目

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. 我下载了agent.zip文件并运行了powershell配置脚本。 When I queue the first build, VSO contacts my build agent and the build works and is published to Azure. 当我将第一个构建排队时,VSO与我的构建代理联系,并且该构建工作并发布到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 | Get-ChildItem -Path $ PSScriptRoot \\ src -Filter project.json -Recurse | ForEach-Object { & echo $_.FullName } ForEach-Object {&echo $ _。FullName}

The error is: 错误是:

2016-02-09T17:13:50.1055064ZC:\\agent\\_work\\1\\s\\MyMeds\\src\\MyMeds\\project.json 2016-02-09T17:13:50.1055064ZC:\\ 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. 2016-02-09T17:13:50.4535551Z ## [error] Get-ChildItem:指定的路径,文件名或两者都太长。 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 ## [错误] 260个字符,目录名称必须少于248个字符。

2016-02-09T17:13:50.4535551Z ##[error]At C:\\agent_work\\1\\s\\MyMeds\\Prebuild.ps1:28 char:1 2016-02-09T17:13:50.4535551Z ## [错误]在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. 另外,如果我手动清除_work目录,则构建成功。 I've tried to clear the work are from within the PowerShell script, but this fails because the script is running in that directory. 我试图清除工作是从PowerShell脚本中进行的,但是失败了,因为该脚本正在该目录中运行。

Any suggestions of how to clear the work directory so that multiple builds will succeed ? 关于如何清除工作目录以使多个构建成功的任何建议?

This is caused by the npm install command in the "PrePublish" script and the npm version used by VS. 这是由“ PrePublish”脚本中的npm install命令和VS使用的npm版本引起的。

  "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. Windows MAXPATH限制为260个字符,而旧的npm版本则不适用。 The latest npm 3.x version has fixed this issue. 最新的npm 3.x版本已解决此问题。 But VS always use 1.4.9 version which cause the long path issue. 但是VS总是使用1.4.9版本,这会导致长路径问题。 See this issue for details: Update node to 5.x and npm to 3.x 有关详细信息,请参见此问题:将节点更新为5.x,将npm更新为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. 现在的解决方法是从project.json文件中删除预发布脚本,并在构建定义中添加其他步骤以执行这些操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM