首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法加载源https://pkgs.dev.azure.com/xxxxx/_packaging/yyyyy/nuget/v3/index.json的服务索引

无法加载源https://pkgs.dev.azure.com/xxxxx/_packaging/yyyyy/nuget/v3/index.json的服务索引
EN

Stack Overflow用户
提问于 2020-04-21 13:26:17
回答 1查看 4.3K关注 0票数 1

我得到这个错误:无法加载源https://pkgs.dev.azure.com/xxxxx/_packaging/xxxxx/nuget/v3/index.json的服务索引。响应状态码未指示成功: 401 (未经授权)。)

我正在尝试从其他组织的azure工件恢复包。enter image description here

错误日志: 38个包到packages.config项目

errorThe nuget命令失败,退出代码(%1)和错误( packages.config项目中的错误

代码语言:javascript
复制
Unable to find version '1.0.976930' of package 'xxxx.Security.Eso.Web.DevSignOn'.
  https://api.nuget.org/v3/index.json: Package 'xxxx.Security.Eso.Web.DevSignOn.1.0.976930' is not found on source 'https://api.nuget.org/v3/index.json'.
  https://pkgs.dev.azure.com/xxxx/_packaging/yyyy/nuget/v3/index.json: Unable to load the service index for source https://pkgs.dev.azure.com/xxxx/_packaging/yyyy/nuget/v3/index.json.
  Response status code does not indicate success: 401 (Unauthorized).)

errorPackages无法恢复

我尝试了这些解决方案,但没有成功: 1. https://mallibone.com/post/private-nuget-feed-azure-devops 2. https://docs.microsoft.com/en-us/azure/devops/pipelines/packages/nuget-restore?view=azure-devops

EN

回答 1

Stack Overflow用户

发布于 2020-07-23 09:50:56

这对我很有效,link。来自github用户@danilobreda

以下是上面链接的答案:

对我有效的..。使用PAT标记。

我的dockerfile:

代码语言:javascript
复制
FROM microsoft/aspnetcore-build:latest AS build
WORKDIR /src
COPY . .
COPY NuGet.Config ./
RUN dir
RUN dotnet restore --configfile NuGet.Config -nowarn:msb3202,nu1503 --verbosity diag
RUN dotnet publish --output /output --configuration Release

FROM microsoft/aspnetcore:latest
WORKDIR /app
COPY --from=build /output /app
ENTRYPOINT ["dotnet", "DockerProject.dll"]

和我的NuGet.Config文件:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="BredasVSTS" value="https://xxxx.pkgs.visualstudio.com/_packaging/BredasVSTS/nuget/v3/index.json" />
  </packageSources>
  <packageSourceCredentials>
    <BredasVSTS>
      <add key="Username" value="emailhere" />      
      <add key="ClearTextPassword" value="PAT here" />
    </BredasVSTS>
  </packageSourceCredentials>
</configuration>

需要传递Username参数,但您可以在此处设置随机的用户名/短语...因为PAT没有username参数。确保nuget包具有PAT owner的权限(读写)。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61336517

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档