I'm using a private NuGet feed through Azure DevOps.To see information about a public NuGet package from code, one simply has to follow the documentation here. In particular:
var logger = NullLogger.Instance;var cancellationToken = CancellationToken.None;var cache = new SourceCacheContext(); var source = new PackageSource("*my feed*/nuget/v3/index.json");source.Credentials = new PackageSourceCredential("*my feed*/nuget/v3/index.json", "tokenName", "token", false, null);var repository = Repository.Factory.GetCoreV2(source);var resource = await repository.GetResourceAsync<PackageMetadataResource>();IEnumerable<IPackageSearchMetadata> searchMetadata = await resource.GetMetadataAsync("My.Package.Name", includePrerelease: false, includeUnlisted: false, cache, logger, cancellationToken);
I cannot get through step
await repository.GetResourceAsync<PackageMetadataResource>()
which keeps failing with a
"Unable to load the service index for source *my feed*/nuget/v3/index.json."
How am I expected to identify an Azure DevOps feed from code, to be able to get the IPackageMetadata information?
Note:I have followed the answers here