Asp.net core “后出现ASP.NET 5 RC1生成错误”;“恢复后”;在VST上构建时

Asp.net core “后出现ASP.NET 5 RC1生成错误”;“恢复后”;在VST上构建时,asp.net-core,azure-devops,azure-pipelines,dnu,Asp.net Core,Azure Devops,Azure Pipelines,Dnu,我正在尝试使用Visual Studio Team Services(又名Visual Studio Online)上提供的新生成系统在我的ASP.NET 5 RC1应用程序上执行dnu还原 Myproject.json包含一个postrestore命令,如下所示: "scripts": { "postrestore": [ "npm install", "bower install", "gulp clean", "gulp min" ] } #Requires -Version 3

我正在尝试使用Visual Studio Team Services(又名Visual Studio Online)上提供的新生成系统在我的ASP.NET 5 RC1应用程序上执行
dnu还原

My
project.json
包含一个
postrestore
命令,如下所示:

"scripts": {
    "postrestore": [ "npm install", "bower install", "gulp clean", "gulp min" ]
}
#Requires -Version 3.0

param($vsoProjectName, $projectName, $buildConfiguration, $buildSourcesDirectory)

$VerbosePreference = "continue"
$ErrorActionPreference = "Continue"

&{$Branch='dev';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}
$globalJson = Get-Content -Path "$PSScriptRoot\global.json" -Raw -ErrorAction Ignore | ConvertFrom-Json -ErrorAction Ignore

if($globalJson)
{
    $dnxVersion = $globalJson.sdk.version
}
else
{
    Write-Warning "Unable to locate global.json to determine using 'latest'"
    $dnxVersion = "latest"
}

& $env:USERPROFILE\.dnx\bin\dnvm install $dnxVersion -r coreclr -arch x86 -Persistent

$dnxRuntimePath = "$($env:USERPROFILE)\.dnx\runtimes\dnx-coreclr-win-x86.$dnxVersion"

Write-Host "BuildSourcesDirectory: $buildSourcesDirectory"
Write-Host "Project Path: $PSScriptRoot\src\$projectName"
Write-Host "Publish output: $buildSourcesDirectory\$vsoProjectName\artifacts\bin\$buildConfiguration\Publish"

Write-Host "Print dnu version"

& "dnu" "--version"

Write-Host "Starting DNU restore on all projects"

 # run DNU restore on all project.json files in the src folder including 2>1 to redirect stderr to stdout for badly behaved tools
Get-ChildItem -Path $PSScriptRoot\src -Filter project.json -Recurse | ForEach-Object { & dnu restore $_.FullName 2>1 }

Write-Host "Finished DNU restore"
在执行
dnu还原后
我可以看到构建日志中重复出现了几次错误,内容如下:

2015-12-28T17:49:15.6910525Z###[错误]指定的路径、文件名或两者都太长。完全限定文件名必须少于260个字符,目录名必须少于248个字符。

如果我在本地开发人员机器上的命令行上执行
dnu还原
,我就不会遇到这个问题。 为什么在VSTS构建中会发生这种情况,我如何修复它

我的构建脚本如下所示:

"scripts": {
    "postrestore": [ "npm install", "bower install", "gulp clean", "gulp min" ]
}
#Requires -Version 3.0

param($vsoProjectName, $projectName, $buildConfiguration, $buildSourcesDirectory)

$VerbosePreference = "continue"
$ErrorActionPreference = "Continue"

&{$Branch='dev';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}
$globalJson = Get-Content -Path "$PSScriptRoot\global.json" -Raw -ErrorAction Ignore | ConvertFrom-Json -ErrorAction Ignore

if($globalJson)
{
    $dnxVersion = $globalJson.sdk.version
}
else
{
    Write-Warning "Unable to locate global.json to determine using 'latest'"
    $dnxVersion = "latest"
}

& $env:USERPROFILE\.dnx\bin\dnvm install $dnxVersion -r coreclr -arch x86 -Persistent

$dnxRuntimePath = "$($env:USERPROFILE)\.dnx\runtimes\dnx-coreclr-win-x86.$dnxVersion"

Write-Host "BuildSourcesDirectory: $buildSourcesDirectory"
Write-Host "Project Path: $PSScriptRoot\src\$projectName"
Write-Host "Publish output: $buildSourcesDirectory\$vsoProjectName\artifacts\bin\$buildConfiguration\Publish"

Write-Host "Print dnu version"

& "dnu" "--version"

Write-Host "Starting DNU restore on all projects"

 # run DNU restore on all project.json files in the src folder including 2>1 to redirect stderr to stdout for badly behaved tools
Get-ChildItem -Path $PSScriptRoot\src -Filter project.json -Recurse | ForEach-Object { & dnu restore $_.FullName 2>1 }

Write-Host "Finished DNU restore"
以下是执行postrestore时的日志部分:

2015-12-28T17:46:49.2776081Z Executing script 'postrestore' in project.json
2015-12-28T17:48:57.7983599Z rimraf@2.2.8 node_modules\rimraf
2015-12-28T17:48:57.7993593Z gulp-concat@2.5.2 node_modules\gulp-concat
2015-12-28T17:48:57.7993593Z Γö£ΓöÇΓöÇ through2@0.6.5 (xtend@4.0.1, readable-stream@1.0.33)
2015-12-28T17:48:57.8003598Z Γö£ΓöÇΓöÇ gulp-util@3.0.7 (array-differ@1.0.0, array-uniq@1.0.2, lodash._reevaluate@3.0.0, object-assign@3.0.0, lodash._reinterpolate@3.0.0, beeper@1.1.0, lodash._reescape@3.0.0, fancy-log@1.1.0, replace-ext@0.0.1, has-gulplog@0.1.0, minimist@1.2.0, chalk@1.1.1, vinyl@0.5.3, gulplog@1.0.0, lodash.template@3.6.2, through2@2.0.0, multipipe@0.1.2, dateformat@1.0.12)
2015-12-28T17:48:57.8003598Z ΓööΓöÇΓöÇ concat-with-sourcemaps@1.0.4 (source-map@0.5.3)
2015-12-28T17:48:57.8013590Z gulp-cssmin@0.1.7 node_modules\gulp-cssmin
2015-12-28T17:48:57.8163579Z Γö£ΓöÇΓöÇ filesize@2.0.4
2015-12-28T17:48:57.8163579Z Γö£ΓöÇΓöÇ graceful-fs@2.0.3
2015-12-28T17:48:57.8173592Z Γö£ΓöÇΓöÇ map-stream@0.0.4
2015-12-28T17:48:57.8173592Z Γö£ΓöÇΓöÇ gulp-rename@1.1.0
2015-12-28T17:48:57.8183601Z Γö£ΓöÇΓöÇ temp-write@0.1.1 (tempfile@0.1.3)
2015-12-28T17:48:57.8183601Z Γö£ΓöÇΓöÇ gulp-util@2.2.20 (lodash._reinterpolate@2.4.1, minimist@0.2.0, chalk@0.5.1, vinyl@0.2.3, through2@0.5.1, lodash.template@2.4.1, multipipe@0.1.2, dateformat@1.0.12)
2015-12-28T17:48:57.8193590Z ΓööΓöÇΓöÇ clean-css@3.4.8 (commander@2.8.1, source-map@0.4.4)
2015-12-28T17:48:57.8193590Z gulp@3.9.0 node_modules\gulp
2015-12-28T17:48:57.8193590Z Γö£ΓöÇΓöÇ interpret@0.6.6
2015-12-28T17:48:57.8203588Z Γö£ΓöÇΓöÇ pretty-hrtime@1.0.1
2015-12-28T17:48:57.8203588Z Γö£ΓöÇΓöÇ deprecated@0.0.1
2015-12-28T17:48:57.8213583Z Γö£ΓöÇΓöÇ archy@1.0.0
2015-12-28T17:48:57.8213583Z Γö£ΓöÇΓöÇ tildify@1.1.2 (os-homedir@1.0.1)
2015-12-28T17:48:57.8223587Z Γö£ΓöÇΓöÇ minimist@1.2.0
2015-12-28T17:48:57.8223587Z Γö£ΓöÇΓöÇ v8flags@2.0.11 (user-home@1.1.1)
2015-12-28T17:48:57.8223587Z Γö£ΓöÇΓöÇ chalk@1.1.1 (escape-string-regexp@1.0.4, ansi-styles@2.1.0, supports-color@2.0.0, has-ansi@2.0.0, strip-ansi@3.0.0)
2015-12-28T17:48:57.8233588Z Γö£ΓöÇΓöÇ semver@4.3.6
2015-12-28T17:48:57.8233588Z Γö£ΓöÇΓöÇ orchestrator@0.3.7 (stream-consume@0.1.0, sequencify@0.0.7, end-of-stream@0.1.5)
2015-12-28T17:48:57.8243588Z Γö£ΓöÇΓöÇ liftoff@2.2.0 (extend@2.0.1, rechoir@0.6.2, flagged-respawn@0.3.1, resolve@1.1.6, findup-sync@0.3.0)
2015-12-28T17:48:57.8243588Z Γö£ΓöÇΓöÇ gulp-util@3.0.7 (array-differ@1.0.0, array-uniq@1.0.2, lodash._reevaluate@3.0.0, lodash._reinterpolate@3.0.0, fancy-log@1.1.0, beeper@1.1.0, lodash._reescape@3.0.0, object-assign@3.0.0, replace-ext@0.0.1, has-gulplog@0.1.0, vinyl@0.5.3, gulplog@1.0.0, lodash.template@3.6.2, through2@2.0.0, multipipe@0.1.2, dateformat@1.0.12)
2015-12-28T17:48:57.8253601Z ΓööΓöÇΓöÇ vinyl-fs@0.3.14 (graceful-fs@3.0.8, vinyl@0.4.6, defaults@1.0.3, strip-bom@1.0.0, mkdirp@0.5.1, through2@0.6.5, glob-stream@3.1.18, glob-watcher@0.0.6)
2015-12-28T17:48:57.8253601Z gulp-uglify@1.2.0 node_modules\gulp-uglify
2015-12-28T17:48:57.8263595Z Γö£ΓöÇΓöÇ deap@1.0.0
2015-12-28T17:48:57.8263595Z Γö£ΓöÇΓöÇ through2@0.6.5 (xtend@4.0.1, readable-stream@1.0.33)
2015-12-28T17:48:57.8273590Z Γö£ΓöÇΓöÇ vinyl-sourcemaps-apply@0.1.4 (source-map@0.1.43)
2015-12-28T17:48:57.8273590Z Γö£ΓöÇΓöÇ gulp-util@3.0.7 (array-differ@1.0.0, array-uniq@1.0.2, lodash._reevaluate@3.0.0, lodash._reinterpolate@3.0.0, fancy-log@1.1.0, lodash._reescape@3.0.0, beeper@1.1.0, object-assign@3.0.0, replace-ext@0.0.1, has-gulplog@0.1.0, minimist@1.2.0, vinyl@0.5.3, gulplog@1.0.0, chalk@1.1.1, lodash.template@3.6.2, through2@2.0.0, multipipe@0.1.2, dateformat@1.0.12)
2015-12-28T17:48:57.8283589Z ΓööΓöÇΓöÇ uglify-js@2.4.19 (uglify-to-browserify@1.0.2, async@0.2.10, source-map@0.1.34, yargs@3.5.4)
2015-12-28T17:49:13.9980542Z [17:49:13] Using gulpfile C:\a\1\s\AspNet5Rc1\src\AspNet5Rc1\gulpfile.js
2015-12-28T17:49:13.9980542Z [17:49:13] Starting 'clean:js'...
2015-12-28T17:49:13.9990527Z [17:49:13] Starting 'clean:css'...
2015-12-28T17:49:13.9990527Z [17:49:13] Finished 'clean:js' after 1.77 ms
2015-12-28T17:49:14.0000527Z [17:49:13] Finished 'clean:css' after 1.62 ms
2015-12-28T17:49:14.0000527Z [17:49:13] Starting 'clean'...
2015-12-28T17:49:14.0440528Z [17:49:13] Finished 'clean' after 6.9 ╬╝s
2015-12-28T17:49:15.4640537Z [17:49:15] Using gulpfile C:\a\1\s\AspNet5Rc1\src\AspNet5Rc1\gulpfile.js
2015-12-28T17:49:15.4650529Z [17:49:15] Starting 'min:js'...
2015-12-28T17:49:15.4650529Z [17:49:15] Starting 'min:css'...
2015-12-28T17:49:15.5170528Z [17:49:15] Finished 'min:js' after 69 ms
2015-12-28T17:49:15.5420528Z [17:49:15] Finished 'min:css' after 83 ms
2015-12-28T17:49:15.5490528Z [17:49:15] Starting 'min'...
2015-12-28T17:49:15.5490528Z [17:49:15] Finished 'min' after 18 ╬╝s
2015-12-28T17:49:15.5660525Z Restore complete, 246685ms elapsed
2015-12-28T17:49:15.5670522Z Feeds used:
2015-12-28T17:49:15.5670522Z     https://api.nuget.org/v3-flatcontainer/
2015-12-28T17:49:15.5700509Z Installed:
2015-12-28T17:49:15.5720509Z     211 package(s) to C:\Users\buildguest\.dnx\packages
2015-12-28T17:49:15.6910525Z ##[error]The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
2015-12-28T17:49:15.6930524Z ##[error]The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
2015-12-28T17:49:15.6940524Z ##[error]The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
2015-12-28T17:49:15.6990526Z ##[error]The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
2015-12-28T17:49:15.7750517Z ##[error]The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
2015-12-28T17:49:15.7760529Z ##[error]The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
2015-12-28T17:49:15.7810522Z ##[error]The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
2015-12-28T17:49:15.7830524Z ##[error]The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
2015-12-28T17:49:15.8200522Z ##[error]The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
2015-12-28T17:49:15.8230511Z ##[error]The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
2015-12-28T17:49:15.8280527Z ##[error]The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
2015-12-28T17:49:15.8300524Z ##[error]The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
2015-12-28T17:49:15.8630530Z ##[error]The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
2015-12-28T17:49:15.8640526Z ##[error]The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
2015-12-28T17:49:15.8690519Z ##[error]The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
2015-12-28T17:49:15.8710530Z ##[error]The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
2015-12-28T17:49:15.9030521Z Finished DNU restore

您达到了NTFS文件、路径和名称长度255个字符的限制。包依赖项的NPM嵌套是您遇到限制的原因,这是Windows堆栈上的一个已知节点问题。您应该尝试将NPM更新到最新版本3.0或更高版本,他们现在使用一种平面方法来处理包依赖关系

执行以下操作:

1) 通过更新到最新版本的节点(从下载),在生成计算机上更新NPM

2) 通过将以下参数传递到MSBuild,确保Visual Studio Team System在生成项目时未使用打包的NodeJS版本

/p:ExternalToolsPath="C:\Program Files\nodejs"
或(x86),如果适用:

/p:ExternalToolsPath="C:\Program Files (x86)\nodejs"

您达到了NTFS文件、路径和名称长度255个字符的限制。包依赖项的NPM嵌套是您遇到限制的原因,这是Windows堆栈上的一个已知节点问题。您应该尝试将NPM更新到最新版本3.0或更高版本,他们现在使用一种平面方法来处理包依赖关系

执行以下操作:

1) 通过更新到最新版本的节点(从下载),在生成计算机上更新NPM

2) 通过将以下参数传递到MSBuild,确保Visual Studio Team System在生成项目时未使用打包的NodeJS版本

/p:ExternalToolsPath="C:\Program Files\nodejs"
或(x86),如果适用:

/p:ExternalToolsPath="C:\Program Files (x86)\nodejs"

在VSTS上,考虑到构建系统是托管的,并且构建代理可以运行任何构建机器,我如何确保第1点?关于第2点,我没有直接调用MSBuild,所以我应该在哪里传递nodejs路径信息?在VSTS上,考虑到构建系统是托管的,并且构建代理可以运行任何构建机器,我如何确保第1点?关于第2点,我没有直接调用MSBuild,所以我应该在哪里传递nodejs路径信息?