You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Im trying to use Nuget.Protocol to query nuget.org v3 but since im behind corporate proxy i need to pass my http_proxy to the request. But im struggling to find how to do this efficiently
the cuurent working way i figured is usign a config file and then load it like below, although it works i would like construct the configs in memory like VirtualSettings rather than reading/writing to the file.
using NuGet.Common;
using NuGet.Configuration;
using NuGet.Protocol;
using NuGet.Protocol.Core.Types;
// this config file has creds and http_proxy uri set
var settings = Settings.LoadDefaultSettings(@"C:\Users\myuser\AppData\Roaming\NuGet\NuGet.Config");
var packageSource = new PackageSourceProvider(settings).GetPackageSourceByName("Artifactory");
var repo = Repository.Factory.GetCoreV3(packageSource);
var resource = await repo.GetResourceAsync<FindPackageByIdResource>();
var versions = await resource.GetAllVersionsAsync("Newtonsoft.Json", new SourceCacheContext(), NullLogger.Instance, CancellationToken.None);
Console.WriteLine($"Available versions of Newtonsoft.Json: {string.Join(", ", versions)}");
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Im trying to use
Nuget.Protocolto query nuget.org v3 but since im behind corporate proxy i need to pass myhttp_proxyto the request. But im struggling to find how to do this efficientlythe cuurent working way i figured is usign a config file and then load it like below, although it works i would like construct the configs in memory like VirtualSettings rather than reading/writing to the file.
Beta Was this translation helpful? Give feedback.
All reactions