![](/img/trans.png)
[英]Azure devops Cant connect Nuget Restore and VSBuild for Nuget Packages
[英]How can I change the VSBuild agent location on Azure Devops?
我們有一個項目,我想在其中簽入 PR,但幾天前構建出錯了。 事實證明,在沒有任何代碼/管道更改的情況下,Azure Devops 構建出錯並出現以下錯誤腳本。
我在網上找到了很多解決方案,主要是針對本地錯誤,但都沒有解決我的問題。
我們在我們的計算機上使用 VS2019(沒有任何問題),使用 .Net Core 2.2 和 Angular 6。
日志:
gyp verb using MSBuild: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\15.0\Bin\MSBuild.exe
gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\15.0\Bin\MSBuild.exe
gyp info spawn args [
gyp info spawn args 'build/binding.sln',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Release;Platform=x64'
gyp info spawn args ]
gyp ERR! UNCAUGHT EXCEPTION
##[error]EXEC(0,0): Error : spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\15.0\Bin\MSBuild.exe ENOENT
EXEC : gyp ERR! stack error : spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\15.0\Bin\MSBuild.exe ENOENT [d:\a\1\s\Web\Web.csproj]
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
gyp ERR! stack at onErrorNT (internal/child_process.js:456:16)
gyp ERR! stack at processTicksAndRejections (internal/process/task_queues.js:80:21)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "d:\\a\\1\\s\\Web\\ClientApp\\node_modules\\@angular-devkit\\build-angular\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd d:\a\1\s\Web\ClientApp\node_modules\@angular-devkit\build-angular\node_modules\node-sass
gyp ERR! node -v v12.13.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! This is a bug in `node-gyp`.
gyp ERR! Try to update node-gyp and file an Issue if it does not help:
gyp ERR! <https://github.com/nodejs/node-gyp/issues>
##[error]EXEC(0,0): Error code: 7
EXEC : Build failed with error code: 7 [d:\a\1\s\Web\Web.csproj]
yml:
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
我認為此時問題將出在 msbuild 版本上,但不知道(並且找不到)如何在托管代理上解決該問題。
非常感謝。
臨時解決方案可以是向管道添加新節點任務,在其中將節點版本設置為舊版本(例如,10.16.3 應該可以工作)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.