Azure Pipeline 中缺少 NuGet 包

问题描述 投票:0回答:1

我正在运行 Azure 管道来构建 .net 解决方案并创建用于部署的工件。我在构建解决方案步骤之前包含了 NuGet 恢复步骤,但我收到了多个错误实例:

此项目引用了此计算机上缺少的 NuGet 包。使用 NuGet Package Restore 下载它们。

还有一些关于一些包裹的消息

找不到元数据文件“....\packages\dllName”

我尝试删除项目文件中的 PackageReference 元素,完全删除 PackageReference 进程,将 NuGet 版本更新到最新,检查 NuGet.Config 文件、NuGet 源,但找不到此问题的解决方案。

msbuild azure-pipelines nuget nuget-package-restore
1个回答
0
投票

经过数小时的故障排除,答案是“NuGet Restore”任务中的解决方案文件名不正确,并且没有记录任何内容表明未找到解决方案。 “NuGet Restore”命令正在运行并完成,但未将任何包放入包文件夹中。 “NuGet Restore”命令的输出非常简单,没有显示任何活动:

C:\Windows\system32\chcp.com 65001   
Active code page: 65001  
Detected NuGet version 6.11.0.119 /   
6.11.0+324d7272b8526a3826ef1f12fa6fc3a362b5bb79.324d7272b8526a3826ef1f12fa6fc3a362b5bb79  
Finishing: NuGet restore  

在“NuGet Restore”任务和构建任务中更改解决方案的路径后,解决方案构建成功。 “NuGet Restore”任务的输出应该看起来更像这样:

C:\Windows\system32\chcp.com 65001
Active code page: 65001
Detected NuGet version 6.11.0.119 / 6.11.0+324d7272b8526a3826ef1f12fa6fc3a362b5bb79.324d7272b8526a3826ef1f12fa6fc3a362b5bb79
C:\hostedtoolcache\windows\NuGet\6.11.0\x64\nuget.exe restore D:\a\1\s\Solutions\Portals\PCPC-ADX8Portal.sln -PackagesDirectory D:\a\1\s\packages -Verbosity Detailed -NonInteractive -ConfigFile D:\a\1\s\Solutions\Portals\.nuget\NuGet.Config
NuGet Version: 6.11.0.119
MSBuild auto-detection: using msbuild version '17.10.4.21802' from 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
MSBuild P2P timeout [ms]: 120000
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\bin\msbuild.exe "C:\Users\VssAdministrator\AppData\Local\Temp\NuGetScratch\lzizzmep.ojf.nugetinputs.targets" /t:GenerateRestoreGraphFile /nologo /nr:false /v:q /p:NuGetPropsFile="C:\Users\VssAdministrator\AppData\Local\Temp\NuGetScratch\x4bmft5s.yrp.nugetrestore.props" /p:NuGetRestoreTargets="C:\Users\VssAdministrator\AppData\Local\Temp\NuGetScratch\xecznazl.lha.nugetrestore.targets" /p:RestoreUseCustomAfterTargets="True" /p:DisableCheckingDuplicateNuGetItems="True" /p:RestoreTaskAssemblyFile="C:\hostedtoolcache\windows\NuGet\6.11.0\x64\nuget.exe" /p:RestoreSolutionDirectory="D:\a\1\s\Solutions\Portals\\" /p:RestoreConfigFile="D:\a\1\s\Solutions\Portals\.nuget\NuGet.Config" /p:RestorePackagesPath="D:\a\1\s\packages" /p:SolutionDir="D:\a\1\s\Solutions\Portals\\" /p:SolutionName="PCPC-ADX8Portal"

Restoring NuGet package AntiXSS.4.3.0.
Restoring NuGet package Antlr.3.5.0.2.
  GET https://api.nuget.org/v3-flatcontainer/antixss/4.3.0/antixss.4.3.0.nupkg
  GET https://api.nuget.org/v3-flatcontainer/antlr/3.5.0.2/antlr.3.5.0.2.nupkg
  OK https://api.nuget.org/v3-flatcontainer/antlr/3.5.0.2/antlr.3.5.0.2.nupkg 19ms
Acquiring lock for the installation of Antlr 3.5.0.2
Acquired lock for the installation of Antlr 3.5.0.2
  OK https://api.nuget.org/v3-flatcontainer/antixss/4.3.0/antixss.4.3.0.nupkg 58ms
Acquiring lock for the installation of AntiXSS 4.3.0
Acquired lock for the installation of AntiXSS 4.3.0
PackageSignatureVerificationLog: PackageIdentity: Antlr.3.5.0.2 Source: https://api.nuget.org/v3/index.json PackageSignatureValidity: True
PackageSignatureVerificationLog: PackageIdentity: AntiXSS.4.3.0 Source: https://api.nuget.org/v3/index.json PackageSignatureValidity: True
Installed Antlr 3.5.0.2 from https://api.nuget.org/v3/index.json to C:\Users\VssAdministrator\.nuget\packages\antlr\3.5.0.2 with content hash CSfrVuDVMx3OrQhT84zed+tOdM1clljyRLWWlQM22fJsmG836RVDGQlE6tzysXh8X8p9UjkHbLr6OqEIVhtdEA==.
Adding package 'Antlr.3.5.0.2' to folder 'D:\a\1\s\packages'
Added package 'Antlr.3.5.0.2' to folder 'D:\a\1\s\packages'
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.