繁体   English   中英

Azure Pipelines未使用指定的NuGet版本

[英]Azure Pipelines is not using the NuGet version specified

这是我的原始YML文件。

trigger:
- master

pool:
  vmImage: 'Ubuntu-16.04'

variables:
  buildConfiguration: 'Release'

steps:

- task: NuGetToolInstaller@0
  displayName: "NuGet use 4.9.3"
  inputs:
    versionSpec: 4.9.3

- task: DotNetCoreInstaller@0
  inputs:
    version: '2.2.104'

- task: NuGetCommand@2
  displayName: "NuGet Restore"
  inputs:
    restoreSolution: '**/*.csproj'

- task: DotNetCoreCLI@2
  displayName: ".NET build"
  inputs:
    projects: '**/*.csproj'
    arguments: --configuration $(BuildConfiguration) --no-restore

- task: DotNetCoreCLI@2
  displayName: ".NET publish package"
  inputs:
    command: publish
    arguments: '--configuration $(BuildConfiguration) --no-restore --output $(Build.ArtifactStagingDirectory)/app/pkg'

这是我在Nuget Restore步骤中获得的输出。

[节]开始:NuGet恢复=========================================== =================================任务:NuGet描述:恢复,打包或推送NuGet软件包,或者运行一个NuGet命令。 支持NuGet.org和经过身份验证的提要,例如“软件包管理”和“ MyGet”。 使用NuGet.exe并与.NET Framework应用程序一起使用。 对于.NET Core和.NET Standard应用程序,请使用.NET Core任务。 版本:2.147.6作者:Microsoft Corporation帮助: 更多信息 ===================================== ========================================缓存工具:NuGet 4.1.0 x64找到高速缓存中的工具:NuGet 4.1.0 x64从高速缓存中解决:4.1.0使用版本:4.1.0在高速缓存中找到工具:NuGet 4.1.0 x64

如何禁用“工具缓存”的使用? 它使用4.1.0而不是4.9.3。

更新:根据评论的建议,我更新了我的YML文件。

trigger:
- master

pool:
  vmImage: 'vs2017-win2016'

variables:
  buildConfiguration: 'Release'

steps:

- task: DotNetCoreCLI@2
  inputs:
    command: restore

- task: DotNetCoreCLI@2
  displayName: ".NET build"
  inputs:
    projects: '**/*.csproj'
    arguments: --configuration $(BuildConfiguration) --no-restore

- task: DotNetCoreCLI@2
  displayName: ".NET publish package"
  inputs:
    command: publish
    arguments: '--configuration $(BuildConfiguration) --no-restore --output $(Build.ArtifactStagingDirectory)/app/pkg'

我仍然遇到错误。

它仍然在做同样的事情。

启动NuGet还原

任务:NuGet说明:恢复,打包或推送NuGet程序包,或运行NuGet命令。 支持NuGet.org和经过身份验证的提要,例如“软件包管理”和“ MyGet”。 使用NuGet.exe并与.NET Framework应用程序一起使用。 对于.NET Core和.NET Standard应用程序,请使用.NET Core任务。 版本:2.147.6作者:Microsoft Corporation帮助:更多信息https://go.microsoft.com/fwlink/?LinkID=613747

缓存工具:NuGet 4.1.0 x64在缓存中找到工具:NuGet 4.1.0 x64从工具缓存中解析:4.1.0使用版本:4.1.0在缓存中找到工具:NuGet 4.1.0 x64 SYSTEMVSSCONNECTION存在true SYSTEMVSSCONNECTION存在true [命令] C:\\ windows \\ system32 \\ chcp.com 65001活动代码页:65001检测到NuGet版本4.1.0.2450 / 4.1.0 SYSTEMVSSCONNECTION存在true将NuGet.config保存到临时配置文件。 [命令] C:\\ hostedtoolcache \\ windows \\ NuGet \\ 4.1.0 \\ x64 \\ nuget.exe源添加-NonInteractive-名称NuGetOrg-源https://www.nuget.org/api/v2/ -ConfigFile d:\\ a \\ 1 \\ Nuget \\ tempNuGet_57.config已成功添加名称为NuGetOrg的软件包源。 将NuGet.config保存到临时配置文件。

当它不再存在于我的YML文件中时,为什么还要进行Nuget Restore?

工具安装程序和NuGet任务更适合Windows计算机。 由于您使用的是Ubuntu代理,因此只需使用dotnet restore命令:

- task: DotNetCoreCLI@2
  inputs:
    command: restore

这对我有用

- task: NuGetToolInstaller@0
  displayName: 'Use NuGet 4.9.x'
  inputs:
    versionSpec: 4.9.x

- task: NuGetCommand@2
  displayName: 'NuGet restore'
  inputs:
    restoreSolution: '$(Pipeline.TriggerDirectory)/Library.sln'
    vstsFeed: '[your feed here]'
    noCache: true

日志记录

工具安装

[section]开始:使用NuGet 4.9.x
================================================== =======================任务:NuGet工具安装程序
描述:从互联网或工具缓存中获取特定版本的NuGet,并将其添加到PATH。 使用此任务可以更改NuGet任务中使用的NuGet的版本。
版本:0.145.0
作者:微软公司
帮助: 更多信息
================================================== =======================您在版本字符串上使用查询匹配。 NuGet更新到新版本时,可能会发生行为更改或重大更改。 下载: https//dist.nuget.org/win-x86-commandline/v4.9.3/nuget.exe
缓存工具:NuGet 4.9.3 x64
使用版本:4.9.3
在缓存中找到工具:NuGet 4.9.3 x64
使用工具路径:C:\\ hostedtoolcache \\ windows \\ NuGet \\ 4.9.3 \\ x64带有路径的前置PATH环境变量:C:\\ hostedtoolcache \\ windows \\ NuGet \\ 4.9.3 \\ x64
[部分]完成:使用NuGet 4.9.x

包还原

[节]开始:NuGet恢复=========================================== ============================任务:NuGet
描述:还原,打包或推送NuGet软件包,或运行NuGet命令。 支持NuGet.org和经过身份验证的提要,例如“软件包管理”和“ MyGet”。 使用NuGet.exe并与.NET Framework应用程序一起使用。 对于.NET Core和.NET Standard应用程序,请使用.NET Core任务。
版本:2.147.6
作者:微软公司
帮助: 更多信息
================================================== ======================= SYSTEMVSSCONNECTION存在true
SYSTEMVSSCONNECTION存在
[命令] C:\\ windows \\ system32 \\ chcp.com 65001
活动代码页:65001
检测到NuGet版本4.9.3.5777 / 4.9.3 + e5150f1e119e456e01c4f1e413213d392eda1c3a
SYSTEMVSSCONNECTION存在
将NuGet.config保存到临时配置文件。
[命令] C:\\ hostedtoolcache \\ windows \\ NuGet \\ 4.9.3 \\ x64 \\ nuget.exe

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM