【发布时间】:2019-02-26 18:37:12
【问题描述】:
这是我原来的 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 还原步骤获得的输出。
[section]开始:NuGet 还原 ==================================================== ============================ 任务:NuGet 描述:恢复、打包或推送 NuGet 包,或运行 NuGet 命令。支持 NuGet.org 并经过身份验证 包管理和 MyGet 等提要。使用 NuGet.exe 并与 .NET 框架应用程序。对于 .NET Core 和 .NET Standard 应用,使用 .NET 核心任务。版本:2.147.6 作者:微软 公司帮助:More Information ==================================================== ============================ 缓存工具: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。
更新:按照 cmets 的建议,我更新了我的 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 框架应用程序。对于 .NET Core 和 .NET Standard 应用,使用 .NET 核心任务。版本:2.147.6 作者:微软 公司帮助 : 更多 信息 h t t p s://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 -Name NuGetOrg -Source https://www.nuget.org/api/v2/-配置文件 d:\a\1\Nuget\tempNuGet_57.config 包源名称:NuGetOrg 添加成功。将 NuGet.config 保存到临时配置文件。
当它不再在我的 YML 文件中时,它为什么还要执行 Nuget 还原?
【问题讨论】:
-
尝试将此
noCache: true添加到 NuGet 还原任务。 -
如果它在 Ubuntu 上运行我会感到惊讶,因为任务描述:使用 NuGet.exe。如果这是 .NET Core 应用程序,请使用
dotnet restore。 -
不走运,它还在做同样的事情。
-
我最终使用了 Microsoft Docs 示例中的 YML 文件并使用了 windows-2019。有效。 github.com/MicrosoftDocs/pipelines-dotnet-core/blob/master/…
标签: azure azure-devops nuget yaml azure-web-app-service