我得到这个错误:无法加载源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项目中的错误
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
发布于 2020-07-23 09:50:56
这对我很有效,link。来自github用户@danilobreda
以下是上面链接的答案:
对我有效的..。使用PAT标记。
我的dockerfile:
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文件:
<?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的权限(读写)。
https://stackoverflow.com/questions/61336517
复制相似问题