azure-pipelines - 在 Azure DevOps 服务器中使用私有 Azure 工件中的包
问题描述
我正在使用 Azure DevOps On-Prem(版本 Dev17.M153.3)并且我有 2 个项目。假设第一个是'A',第二个是'B'
PS:我正在使用我自己的构建代理。
一个项目没有任何依赖。 B 项目依赖于A 项目。
我为A 项目创建了一个构建管道,然后我从私有 Azure Artifacts 发布了包。现在我需要在我的B 项目的构建管道中使用这个包。
我的提要权限如下;
我的B 项目从 NuGet 管理器中引用了 A 项目。但是当我尝试完成构建时,我在恢复时遇到了错误。
从 vstsFeed 开始尝试 :(
- task: DotNetCoreCLI@2
inputs:
command: 'restore'
projects: '**/src/**/*.csproj'
feedsToUse: 'select'
vstsFeed: '/ea7b2012-c3d3-40e5-80da-487d4013a34f'
从 Nuget.config 文件第二次尝试
- task: DotNetCoreCLI@2
inputs:
command: 'restore'
projects: '**/src/**/*.csproj'
feedsToUse: config
nugetConfigPath: '$(Build.SourcesDirectory)/src/Naf.Core.Repository/NuGet.config'
includeNuGetOrg: true
两者都不起作用,我收到了这个错误
Restoring packages for .NETCoreApp,Version=v3.1...
GET https://api.nuget.org/v3-flatcontainer/naf.models/index.json
1>C:\Azure-Nuevo-Build\_tool\dotnet\sdk\3.1.201\NuGet.targets(124,5): error : Unable to load the service index for source https://xxx.xxxx.com:1234/prj/_packaging/29371197-8dc0-72e7-b8e9-233be25307e3/nuget/v3/index.json. [C:\XXX-XXX-XXX\3\s\src\Naf.Core.Repository\Naf.Core.Repository.csproj]
C:\Azure-Nuevo-Build\_tool\dotnet\sdk\3.1.201\NuGet.targets(124,5): error : No credentials are available in the security package [C:\XXX-XXX-XXX\3\s\src\Naf.Core.Repository\Naf.Core.Repository.csproj]
NuGet.Protocol.Core.Types.FatalProtocolException: Unable to load the service index for source https://xxx.xxxx.com:1234/prj/_packaging/29371197-8dc0-72e7-b8e9-233be25307e3/nuget/v3/index.json.
---> System.ComponentModel.Win32Exception (0x8009030E): No credentials are available in the security package
我猜它说不能从管道访问提要。
任何想法来解决这个问题。
在 Azure DevOps Cloud 解决方案中,当您切换“将作业授权范围限制为当前项目”时,它可以工作。但在 Azure DevOps Server (on-prem) 中,该选项不可用。根据这个问题
解决方案
尝试使用custom
命令恢复软件包,看看它是否对您有帮助:
- task: DotNetCoreCLI@2
displayName: 'dotnet custom'
inputs:
command: custom
projects: '**/*.csproj'
custom: restore
arguments: '--force'
vstsFeed: '/ea7b2012-c3d3-40e5-80da-487d4013a34f'
推荐阅读
- coldfusion - isValid("telephone", PN) 使用什么标准来验证 ColdFusion 中的电话号码?
- typescript - 如何为定义的接口赋值?
- python - 将方法添加到 ModelViewset Endpoint 而无需调用 URL 中的方法名称
- javascript - 以更简洁的方式编写此单击以隐藏/显示 jQuery 的想法
- microsoft-graph-api - FindMeetingTimes 仅在有更多可用时返回 5 条建议(空闲时间段)。这是一个已知的错误?
- google-cloud-datalab - SSH 连接失败取决于机器类型
- python - 高效过滤列
- html - 修复了键盘进入屏幕时移动浏览器中的元素问题
- mysql - 在 MySQL 中使用 GROUP BY 在 COUNT 中包含零
- spring - 如何在jsp中保持模型属性值?