2015-12-28 32 views
1

我試圖在ASP.NET 5 RC1應用程序上使用Visual Studio Team Services上提供的新構建系統執行dnu restore(又名Visual Studio Online )。ASP.NET 5 RC1在VSTS上構建「postrestore」後生成錯誤

project.json包含postrestore命令如下:

"scripts": { 
    "postrestore": [ "npm install", "bower install", "gulp clean", "gulp min" ] 
} 

一個dnu restore後,我可以看到在構建日誌中的錯誤重複多次說:

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.

如果我做了dnu restore在我的本地開發機器上的命令行我沒有遇到這個問題。 爲什麼在VSTS版本上發生這種情況,我該如何解決?

我的構建腳本如下:

#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" 

這裏是日誌執行還原後,當從部分:

2015-12-28T17:46:49.2776081Z Executing script 'postrestore' in project.json 
2015-12-28T17:48:57.7983599Z [email protected] node_modules\rimraf 
2015-12-28T17:48:57.7993593Z [email protected] node_modules\gulp-concat 
2015-12-28T17:48:57.7993593Z Γö£ΓöÇΓöÇ [email protected] ([email protected], [email protected]) 
2015-12-28T17:48:57.8003598Z Γö£ΓöÇΓöÇ [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]) 
2015-12-28T17:48:57.8003598Z ΓööΓöÇΓöÇ [email protected] ([email protected]) 
2015-12-28T17:48:57.8013590Z [email protected] node_modules\gulp-cssmin 
2015-12-28T17:48:57.8163579Z Γö£ΓöÇΓöÇ [email protected] 
2015-12-28T17:48:57.8163579Z Γö£ΓöÇΓöÇ [email protected] 
2015-12-28T17:48:57.8173592Z Γö£ΓöÇΓöÇ [email protected] 
2015-12-28T17:48:57.8173592Z Γö£ΓöÇΓöÇ [email protected] 
2015-12-28T17:48:57.8183601Z Γö£ΓöÇΓöÇ [email protected] ([email protected]) 
2015-12-28T17:48:57.8183601Z Γö£ΓöÇΓöÇ [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]) 
2015-12-28T17:48:57.8193590Z ΓööΓöÇΓöÇ [email protected] ([email protected], [email protected]) 
2015-12-28T17:48:57.8193590Z [email protected] node_modules\gulp 
2015-12-28T17:48:57.8193590Z Γö£ΓöÇΓöÇ [email protected] 
2015-12-28T17:48:57.8203588Z Γö£ΓöÇΓöÇ [email protected] 
2015-12-28T17:48:57.8203588Z Γö£ΓöÇΓöÇ [email protected] 
2015-12-28T17:48:57.8213583Z Γö£ΓöÇΓöÇ [email protected] 
2015-12-28T17:48:57.8213583Z Γö£ΓöÇΓöÇ [email protected] ([email protected]) 
2015-12-28T17:48:57.8223587Z Γö£ΓöÇΓöÇ [email protected] 
2015-12-28T17:48:57.8223587Z Γö£ΓöÇΓöÇ [email protected] ([email protected]) 
2015-12-28T17:48:57.8223587Z Γö£ΓöÇΓöÇ [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected]) 
2015-12-28T17:48:57.8233588Z Γö£ΓöÇΓöÇ [email protected] 
2015-12-28T17:48:57.8233588Z Γö£ΓöÇΓöÇ [email protected] ([email protected], [email protected], [email protected]) 
2015-12-28T17:48:57.8243588Z Γö£ΓöÇΓöÇ [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected]) 
2015-12-28T17:48:57.8243588Z Γö£ΓöÇΓöÇ [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]) 
2015-12-28T17:48:57.8253601Z ΓööΓöÇΓöÇ [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]) 
2015-12-28T17:48:57.8253601Z [email protected] node_modules\gulp-uglify 
2015-12-28T17:48:57.8263595Z Γö£ΓöÇΓöÇ [email protected] 
2015-12-28T17:48:57.8263595Z Γö£ΓöÇΓöÇ [email protected] ([email protected], [email protected]) 
2015-12-28T17:48:57.8273590Z Γö£ΓöÇΓöÇ [email protected] ([email protected]) 
2015-12-28T17:48:57.8273590Z Γö£ΓöÇΓöÇ [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]) 
2015-12-28T17:48:57.8283589Z ΓööΓöÇΓöÇ [email protected] ([email protected], [email protected], [email protected], [email protected]) 
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 

回答

0

你打的是NTFS文件,路徑和文件名長度限制255個字符。程序包依賴關係的NPM嵌套是您達到限制的原因,這是Windows堆棧中已知的節點問題。您應該嘗試將NPM更新到最新版本(3.0或更高版本),他們現在使用平面方法來處理程序包依賴性。

執行以下操作:

1)更新NPM構建機器上,通過更新到節點的最新版本(從https://nodejs.org/download下載)。

2)通過將以下參數傳遞給MSBuild,確保Visual Studio Team System在構建項目時不使用打包的NodeJS版本。

/p:ExternalToolsPath="C:\Program Files\nodejs" 

或(86)如果適用:

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

在VSTS如何確保1點考慮構建系統託管和生成代理可以運行任何構建機器?關於第2點,我沒有直接調用MSBuild,所以我應該在哪裏傳遞nodejs路徑信息? – neodymium