使用以下NuGet.Config文件,我在docker容器构建期间收到此错误消息:
设置NuGet.Config的正确方法是什么?
/usr/share/dotnet/sdk/2.1.104/NuGet.targets(104,5): error : Unable to load the service index for source https://mycompany.pkgs.visualstudio.com/_packaging/myfeed/nuget/v3/index.json. [/src/Grains.sln]
/usr/share/dotnet/sdk/2.1.104/NuGet.targets(104,5): error : Response status code does not indicate success: 401 (Unauthorized). [/src/Grains.sln]
我没有正确设置私有nuget Feed的授权。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
<add key="MyCompany" value="https://mycompany.pkgs.visualstudio.com/_packaging/myfeed/nuget/v3/" />
</packageSources>
<!-- Used to store credentials -->
<packageSourceCredentials />
<apikeys>
<add key="https://mycompany.pkgs.visualstudio.com/_packaging/myfeed/nuget/v3/index.json" value="mytoken" />
</apikeys>
</configuration>
答案 0 :(得分:0)
我使用这种格式:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="MyFeed" value="https://mycompany.pkgs.visualstudio.com/_packaging/myfeed/nuget/v3/index.json" />
</packageSources>
<packageSourceCredentials>
<MyFeed>
<add key="Username" value="myemailid" />
<add key="ClearTextPassword" value="mytoken" />
</MyFeed>
</packageSourceCredentials>
</configuration>