Cha*_*mar 5 azure nuget nuget-package-restore devops
我收到此错误:无法加载源https://pkgs.dev.azure.com/xxxxx/_packaging/xxxxx/nuget/v3/index.json的服务索引。响应状态码并不表示成功:401(未经授权)。)
我正在尝试从其他组织的天蓝色工件恢复包。在此输入图像描述
错误日志:38 个包到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).)
Run Code Online (Sandbox Code Playgroud)
我尝试了这些解决方案,但没有运气: 1. https://mallibone.com/post/private-nuget-feed-azure-devops 2. https://learn.microsoft.com/en-us/azure/devops/pipelines /packages/nuget-restore?view=azure-devops
这对我有用,链接。来自 github 用户@danilobreda
以下是上面链接的答案:
对我有用的...使用 PAT 令牌。
我的泊坞窗文件:
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"]
Run Code Online (Sandbox Code Playgroud)
和我的 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>
Run Code Online (Sandbox Code Playgroud)
需要传递用户名参数,但您可以在那里设置随机用户名/短语...因为 PAT 没有用户名参数。确保 nuget 包具有 PAT 所有者的权限(读取和写入)。
| 归档时间: |
|
| 查看次数: |
12725 次 |
| 最近记录: |