.net 无法在Azure管道(工件源)中使用Paket还原NuGet包

.net 无法在Azure管道(工件源)中使用Paket还原NuGet包,.net,azure,nuget,azure-pipelines,paket,.net,Azure,Nuget,Azure Pipelines,Paket,我正在尝试定义一个为.NET Core解决方案构建的管道。依赖项由Paket管理。依赖项是从Azure工件提要下载的 在第一个阶段,我认为问题出在Paket上,我能够定义一个不用它构建的管道(使用私有包源,我们的私有提要) 一旦我修复了Paket问题,我在尝试使dotnet还原工作时遇到了问题 这是我的实际YML定义: 触发器: -没有 游泳池: vmImage:“windows最新版本” 步骤: -任务:UseDotNet@2 投入: packageType:'sdk' 版本:“3.1.x”

我正在尝试定义一个为.NET Core解决方案构建的管道。依赖项由Paket管理。依赖项是从Azure工件提要下载的

在第一个阶段,我认为问题出在Paket上,我能够定义一个不用它构建的管道(使用私有包源,我们的私有提要)

一旦我修复了Paket问题,我在尝试使
dotnet还原
工作时遇到了问题

这是我的实际YML定义:

触发器:
-没有
游泳池:
vmImage:“windows最新版本”
步骤:
-任务:UseDotNet@2
投入:
packageType:'sdk'
版本:“3.1.x”
-powershell:|
光盘
dotnet工具安装-g paket
-任务:setCredentialManager@0
-任务:PaketRestore@0
投入:
PaketPath:“.paket”
-任务:paketCredentialCleanup@0
#我不确定以下任务是否必要
-任务:PowerShell@2
投入:
文件路径:'./installcredprovider.ps1'
-任务:NuGetCommand@2
投入:
命令:“还原”
恢复解决方案:'***.sln'
feedsToUse:'config'
nugetConfigPath:“./NuGet.config”
-任务:CmdLine@2
投入:
脚本:“dotnet还原”
-任务:DotNetCoreCLI@2
投入:
命令:“构建”
项目:“*.csproj”
NuGetCommand@2
还原任务因以下日志而失败:

NuGet Version: 5.4.0.6315
EXEC : Standard error : It was not possible to find any compatible framework version [d:\a\1\s\ArtifactsVs.csproj]
MSBuild auto-detection: using msbuild version '16.5.0.12403' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
EXEC : Standard error : It was not possible to find any compatible framework version [d:\a\1\s\ArtifactsVs.csproj]
MSBuild P2P timeout [ms]: 120000
EXEC : Standard error : It was not possible to find any compatible framework version [d:\a\1\s\ArtifactsVs.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\bin\msbuild.exe "C:\Users\VssAdministrator\AppData\Local\Temp\NuGetScratch\rjysskyy.m01.nugetinputs.targets" /t:GenerateRestoreGraphFile /nologo /nr:false /v:q /p:NuGetRestoreTargets="C:\Users\VssAdministrator\AppData\Local\Temp\NuGetScratch\1cpdh2ma.wgd.nugetrestore.targets" /p:RestoreUseCustomAfterTargets="True" /p:RestoreTaskAssemblyFile="C:\hostedtoolcache\windows\NuGet\5.4.0\x64\nuget.exe" /p:RestoreSolutionDirectory="d:\a\1\s\\" /p:RestoreConfigFile="d:\a\1\s\NuGet.config" /p:SolutionDir="d:\a\1\s\\" /p:SolutionName="ArtifactsVs"
EXEC : Standard error : It was not possible to find any compatible framework version [d:\a\1\s\ArtifactsVs.csproj]
NuGet.CommandLine.ExitCodeException: Exception of type 'NuGet.CommandLine.ExitCodeException' was thrown.
EXEC : Standard error : It was not possible to find any compatible framework version [d:\a\1\s\ArtifactsVs.csproj]
   at NuGet.CommandLine.MsBuildUtility.<GetProjectReferencesAsync>d__6.MoveNext()
EXEC : Standard error : It was not possible to find any compatible framework version [d:\a\1\s\ArtifactsVs.csproj]
--- End of stack trace from previous location where exception was thrown ---
EXEC : Standard error : It was not possible to find any compatible framework version [d:\a\1\s\ArtifactsVs.csproj]
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
EXEC : Standard error : It was not possible to find any compatible framework version [d:\a\1\s\ArtifactsVs.csproj]
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
d:\a\1\s\.paket\Paket.Restore.targets(219,5): error MSB3073: The command ""paket" restore --project "d:\a\1\s\ArtifactsVs.csproj" --output-path "obj" --target-framework "netcoreapp3.1"" exited with code 1. [d:\a\1\s\ArtifactsVs.csproj]
   at NuGet.CommandLine.RestoreCommand.<GetDependencyGraphSpecAsync>d__68.MoveNext()

--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.CommandLine.RestoreCommand.<DetermineInputsFromMSBuildAsync>d__63.MoveNext()
##[error]The nuget command failed with exit code(1) and error(EXEC : Standard error : It was not possible to find any compatible framework version [d:\a\1\s\ArtifactsVs.csproj]
EXEC : Standard error : It was not possible to find any compatible framework version [d:\a\1\s\ArtifactsVs.csproj]
EXEC : Standard error : It was not possible to find any compatible framework version [d:\a\1\s\ArtifactsVs.csproj]
EXEC : Standard error : It was not possible to find any compatible framework version [d:\a\1\s\ArtifactsVs.csproj]
EXEC : Standard error : It was not possible to find any compatible framework version [d:\a\1\s\ArtifactsVs.csproj]
EXEC : Standard error : It was not possible to find any compatible framework version [d:\a\1\s\ArtifactsVs.csproj]
EXEC : Standard error : It was not possible to find any compatible framework version [d:\a\1\s\ArtifactsVs.csproj]
EXEC : Standard error : It was not possible to find any compatible framework version [d:\a\1\s\ArtifactsVs.csproj]
EXEC : Standard error : It was not possible to find any compatible framework version [d:\a\1\s\ArtifactsVs.csproj]
d:\a\1\s\.paket\Paket.Restore.targets(219,5): error MSB3073: The command ""paket" restore --project "d:\a\1\s\ArtifactsVs.csproj" --output-path "obj" --target-framework "netcoreapp3.1"" exited with code 1. [d:\a\1\s\ArtifactsVs.csproj])
##[error]Packages failed to restore
Finishing: NuGetCommand
NuGet版本:5.4.0.6315
EXEC:标准错误:找不到任何兼容的框架版本[d:\a\1\s\ArtifactsVs.csproj]
MSBuild自动检测:使用“C:\Program Files(x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\bin”中的MSBuild版本“16.5.0.12403”。使用选项-MSBuildVersion强制nuget使用特定版本的MSBuild。
EXEC:标准错误:找不到任何兼容的框架版本[d:\a\1\s\ArtifactsVs.csproj]
MSBuild P2P超时[ms]:120000
EXEC:标准错误:找不到任何兼容的框架版本[d:\a\1\s\ArtifactsVs.csproj]
C:\Program Files(x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\bin\MSBuild.exe“C:\Users\VssAdministrator\AppData\Local\Temp\NuGetScratch\rjysskyy.m01.nugetinputs.targets”/t:GenerateRestoreGraphFile/nologo/nr:false/v:q/p:NuGetRestoreTargets=“C:\Users\VssAdministrator\AppData\Local\Temp\NuGetScratch\1cpdh2ma.wgd.nugetrestore.targets”/p:RestoreUseCustomAfterTargets=“True”/p:restoretasksassemblyfile=“C:\hostedtoolcache\windows\NuGet\5.4.0\x64\NuGet.exe”/p:RestoreSolutionDirectory=“d:\a\1\s\\”/p:RestoreConfigFile=“d:\a\1\s\NuGet.config”/p:SolutionDir=”“人工制品”
EXEC:标准错误:找不到任何兼容的框架版本[d:\a\1\s\ArtifactsVs.csproj]
NuGet.CommandLine.ExitCodeException:引发了类型为“NuGet.CommandLine.ExitCodeException”的异常。
EXEC:标准错误:找不到任何兼容的框架版本[d:\a\1\s\ArtifactsVs.csproj]
在NuGet.CommandLine.MsBuildUtility.d_u6.MoveNext()处
EXEC:标准错误:找不到任何兼容的框架版本[d:\a\1\s\ArtifactsVs.csproj]
---来自引发异常的上一个位置的堆栈结束跟踪---
EXEC:标准错误:找不到任何兼容的框架版本[d:\a\1\s\ArtifactsVs.csproj]
在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()中
EXEC:标准错误:找不到任何兼容的框架版本[d:\a\1\s\ArtifactsVs.csproj]
在System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务任务)中
d:\a\1\s\.paket\paket.Restore.targets(219,5):错误MSB3073:命令“paket”Restore--project“d:\a\1\s\ArtifactsVs.csproj”--输出路径“obj”--目标框架“netcoreapp3.1”已退出,代码为1。[d:\a\1\s\ArtifactsVs.csproj]
在NuGet.CommandLine.RestoreCommand.d_u68.MoveNext()中
---来自引发异常的上一个位置的堆栈结束跟踪---
在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()中
在System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务任务)中
在NuGet.CommandLine.RestoreCommand.d_u63.MoveNext()中
##[错误]nuget命令失败,退出代码(1)和错误(EXEC:标准错误:找不到任何兼容的框架版本[d:\a\1\s\ArtifactsVs.csproj]
EXEC:标准错误:找不到任何兼容的框架版本[d:\a\1\s\ArtifactsVs.csproj]
EXEC:标准错误:找不到任何兼容的框架版本[d:\a\1\s\ArtifactsVs.csproj]
EXEC:标准错误:找不到任何兼容的框架版本[d:\a\1\s\ArtifactsVs.csproj]
EXEC:标准错误:找不到任何兼容的框架版本[d:\a\1\s\ArtifactsVs.csproj]
EXEC:标准错误:找不到任何兼容的框架版本[d:\a\1\s\ArtifactsVs.csproj]
EXEC:标准错误:找不到任何兼容的框架版本[d:\a\1\s\ArtifactsVs.csproj]
EXEC:标准错误:找不到任何兼容的框架版本[d:\a\1\s\ArtifactsVs.csproj]
EXEC:标准错误:找不到任何兼容的框架版本[d:\a\1\s\ArtifactsVs.csproj]
d:\a\1\s\.paket\paket.Restore.targets(219,5):错误MSB3073:命令“paket”Restore--project“d:\a\1\s\ArtifactsVs.csproj”--输出路径“obj”--目标框架“netcoreapp3.1”退出,代码为1。[d:\a\1\s\ArtifactsVs.csproj])
##[错误]无法还原程序包
完成:NuGetCommand
无论如何,忽略它,
dotnet restore
也会失败

脚本installcredprovider.ps1的源代码是

存储库可以从下载(提要URL部分混淆)


提前感谢所有想要帮助的人!

我为他们创建了一个测试项目
pool:
  vmImage: 'windows-latest'

steps:

  - task: UseDotNet@2
    inputs:
      packageType: 'sdk'
      version: '2.0.0'

  - task: UseDotNet@2
    inputs:
      packageType: 'sdk'
      version: '3.1.x'

  - powershell: |
      cd ..
      dotnet tool install -g paket

  - task: setCredentialManager@0

  - task: PaketRestore@0
    inputs:
      PaketPath: '.paket'

  - task: paketCredentialCleanup@0

  # - task: PowerShell@2
  #   inputs:
  #     filePath: './installcredprovider.ps1'

  # - task: NuGetToolInstaller@1
  #   inputs:
  #     versionSpec: 5.x

  - task: NuGetCommand@2
    inputs:
      command: 'restore'
      restoreSolution: '**/*.sln'
      feedsToUse: 'config'
      nugetConfigPath: './NuGet.config'