我想從Nuget存儲庫下載需要使用NuGet.Core訪問憑據的包。如何在訪問Nuget Feed時傳遞憑據
我知道,沒有認證的NuGet庫可以如下訪問:
//ID of the package to be looked up
string packageID = "EntityFramework";
//Connect to the official package repository
IPackageRepository repo = PackageRepositoryFactory.Default.CreateRepository("https://packages.nuget.org/api/v2");
//Initialize the package manager
string path = <PATH_TO_WHERE_THE_PACKAGES_SHOULD_BE_INSTALLED>
PackageManager packageManager = new PackageManager(repo, path);
//Download and unzip the package
packageManager.InstallPackage(packageID, SemanticVersion.Parse("5.0.0"));
(來源:Nuget blog)
現在假設我有一個的NuGet庫的憑據。 我試圖使用http客戶端和網絡憑據來獲取軟件包,但沒有奏效。 那麼如何將證書傳遞給Nuget服務器?
另外我想知道如何restrict access to a Nuget feed(新版本提供了什麼?)。
我似乎無法找到任何明確的文檔。
謝謝。
[使用Nuget Core DLL設置包憑證](https://stackoverflow.com/questions/18594613/setting-the-package-credentials-using-nuget-core-dll) – jgauffin