[英]Why is my Azure Dev Ops Pipeline failing to restore a package?
我正在使用 Azure Dev Ops 與我的 ASP.NET Core web 應用程序一起工作。 我正在設置管道,但出現錯誤。 錯誤來自 package 恢復問題,因為我的應用程序使用 KendoUI 庫,我必須為所需的私有 NuGet 包創建服務連接。 完成后,構建仍然失敗,我想知道出了什么問題?
錯誤信息
[錯誤]nuget 命令失敗,退出代碼 (1) 和錯誤(NU1102:無法找到 package Telerik.UI=.for.Asp 版本)
2019.2.619) - 在 NuGetOrg 中找到 1 個版本 [最近的版本:2016.3.914] d:\a\1\s\MyCompany\MyProject.UI.csproj NU1102 中的錯誤:無法找到 package ZBFAAD45105E7D2471. .AspNet.Core 版本 (>= 2019.2.619) - 在 NuGetOrg [最近版本:2016.3.914] 中找到 1 個版本
[錯誤]包恢復失敗
我與 Telerik 支持人員進行了交談,他們說上述代碼是因為身份驗證失敗,這導致系統尋找導致此兼容性問題的舊版本。 我被要求檢查我的身份驗證,但此錯誤仍然存在。
我遵循 Telerik 關於如何實現這一點的文檔,您可以在此處找到: https://www.telerik.com/blogs/azure-devops-和
好的,首先,我的項目在其根目錄中有一個nuget.config
文件。 該文件的內容是:
nuget.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
<packageSources>
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
<add key="Telerik" value="https://nuget.telerik.com/nuget" />
</packageSources>
<packageSourceCredentials>
<Telerik>
<add key="Username" value="me@mybusiness.com" />
<add key="ClearTextPassword" value="MyFunkYPassword19!" />
</Telerik>
</packageSourceCredentials>
</configuration>
在 Azure Dev Ops 中,我按照其文檔中描述的方式創建了一個服務連接,其名稱為用戶名和密碼,如上述代碼
在我的管道中,我添加了 Nuget package 設置為使用上面的服務連接進行恢復。
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
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: NuGetCommand@2
inputs:
command: 'restore'
restoreSolution: '**/*.sln'
feedsToUse: 'config'
nugetConfigPath: 'MyProject/nuget.config'
externalFeedCredentials: 'Telerik NuGet'
- 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: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
上述流水線步驟的設置如下:
有誰知道發生了什么,我的設置不正確嗎?
我設法讓這個工作偶然。 這是導致問題的步驟的順序。 構建的 output 表明,無論我做什么,管道都在查看 tempNuget.config 文件,而不是我指定的文件。 由於作業中有兩個 NuGet 步驟,我將 Telerik 上移了一級,這確保系統使用正確的 nuget 文件,而不是查看它正在創建.config 文件的臨時文件
以下是導致它開始工作的更改步驟,請注意 Telerik 步驟已上移一級。
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
command: 'restore'
restoreSolution: '**/*.sln'
feedsToUse: 'config'
nugetConfigPath: 'MyProject/nuget.config'
externalFeedCredentials: 'Telerik NuGet'
- 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: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.