无法加载源的服务索引https://pkgs.dev.azure.com/xxxxx/_packaging/yyyyy/nuget/v3/index.json
出现以下错误:无法加载源的服务索引。 响应状态代码不表示成功:401(未经授权)。) 我正在尝试从其他组织的azure工件恢复包 错误日志: 38个包到packages.config项目 [错误]nuget命令失败,退出代码为(1),错误为(packages.config项目中的错误) [错误]无法还原程序包 我尝试了这些解决方案,但没有成功: 1. 2.这对我来说很有效,.来自github用户 以下是以上链接的答案:无法加载源的服务索引https://pkgs.dev.azure.com/xxxxx/_packaging/yyyyy/nuget/v3/index.json,azure,nuget,devops,nuget-package-restore,Azure,Nuget,Devops,Nuget Package Restore,出现以下错误:无法加载源的服务索引。 响应状态代码不表示成功:401(未经授权)。) 我正在尝试从其他组织的azure工件恢复包 错误日志: 38个包到packages.config项目 [错误]nuget命令失败,退出代码为(1),错误为(packages.config项目中的错误) [错误]无法还原程序包 我尝试了这些解决方案,但没有成功: 1. 2.这对我来说很有效,.来自github用户 以下是以上链接的答案: 对我有用的是…使用PAT代币 我的dockerfile: FROM mic
对我有用的是…使用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所有者的权限(读写)。“确保nuget软件包具有PAT所有者的权限(读写)”写入前置任务是什么?您能否详细说明最后一条评论?您的解决方案是什么?
<?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>