bde*_*ere 7 c# nuget visual-studio-code azure-devops
我们有一个私人NuGet饲料。它与Visual Studio. 我们的开发人员通过他们的Azure帐户连接到私人订阅源。在转向 vs 代码时,我想保持相同的功能。
使用此处找到的文档,我将 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>
Run Code Online (Sandbox Code Playgroud)
有了Visual Studio你只需要登录并可以连接到饲料。vs代码的这个选项在哪里?我目前收到以下错误消息,这是一件好事,因为显然我没有通过身份验证。我期待弹出某种对话框或必须在某处输入我的凭据。据我所知, 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]
Run Code Online (Sandbox Code Playgroud)
一些文档还提到将凭据放入nuget.config文件中,但我觉得这很奇怪,因为这从来没有必要,Visual Studio而且我也没有可以在这里输入的用户。当然,为私人创建一个服务帐户NuGet是否太过分了?
<packageSourceCredentials>
<Contoso>
<add key="Username" value="user@contoso.com" />
<add key="ClearTextPassword" value="33f!!lloppa" />
</Contoso>
</packageSourceCredentials>
Run Code Online (Sandbox Code Playgroud)
如何NuGet在Azure Devops不将凭据保存在文件中的情况下使用 vs 代码连接到私人提要?
我们最终为 VS Code使用了https://github.com/Microsoft/artifacts-credprovider。它真的很好用。只需按照步骤安装 Microsoft.NuGet.CredentialProvider。之后,您应该能够使用命令“dotnet restore --interactive”恢复包。
| 归档时间: |
|
| 查看次数: |
5677 次 |
| 最近记录: |