我们有一个私人NuGet
喂养。它一直与Visual Studio
。我们的开发人员通过他们的联系Azure
帐户与私人提要。我想在迁移到 VS Code 时保留相同的功能。
使用找到的文档here https://learn.microsoft.com/en-us/azure/devops/pipelines/packages/nuget-restore?view=vsts我将 nuget.config 添加到我的解决方案文件夹中。该配置看起来与文档完全相同,只是其中有我们的私人提要。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!-- remove any machine-wide sources with <clear/> -->
<clear />
<!-- add an Azure Artifacts feed -->
<add key="PrivateFeed" value="https://pkgs.dev.azure.com/redacted/_packaging/redacted/nuget/v3/index.json" />
<!-- also get packages from the NuGet Gallery -->
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
</packageSources>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
</configuration>
With Visual Studio
您只需登录即可连接到提要。 VS Code 的这个选项在哪里?我目前收到下面的错误消息,这是一件好事,因为显然我没有经过身份验证。我期待弹出某种对话框或必须在某处输入我的凭据。据我所知,dotnet Restore 命令也没有任何提供凭据的方法。
C:\Program Files\dotnet\sdk\2.1.500\NuGet.targets(114,5): error : Unable to load the service index for source https://pkgs.dev.azure.com/redacted/_packaging/redacted/nuget/v3/index.json. [redacted]
C:\Program Files\dotnet\sdk\2.1.500\NuGet.targets(114,5): error : Response status code does not indicate success: 401 (Unauthorized). [redacted]
一些文档还提到将凭据放入nuget.config
文件,但我发现这很奇怪,因为这从来没有必要Visual Studio
而且我也没有用户,我可以在这里输入。当然是为私人创建一个服务帐户NuGet
是不是一步太远了?
<packageSourceCredentials>
<Contoso>
<add key="Username" value="[email protected] /cdn-cgi/l/email-protection" />
<add key="ClearTextPassword" value="33f!!lloppa" />
</Contoso>
</packageSourceCredentials>
我如何连接到私人NuGet
以Azure Devops
使用 vs code 而不将凭据保存在文件中?