![](/img/trans.png)
[英]Artifactory restore nuget packages with authentication from powershell
[英]Nuget restore command line responds Package is not found on source - Artifactory cloud server
我知道 NuGet 包在那里。 我可以在我的 Artifactory 頁面上列出它們。 為什么我的nuget restore
命令看不到它們?
我在 JFrog Artifactory 有一台服務器。 假設 URL 是https://companyname.jfrog.io/artifactory 。
我在該位置有一個 NuGet package 存儲庫。 該存儲庫稱為“repo-name-local”。
我的 NuGet 包顯示在https://companyname.jfrog.io/ui/repos/tree/General/repo-name-local
...並且它們出現在https://companyname.jfrog.io/ui/repos/tree/General/repo-name-local的存儲庫列表中
在該頁面上,“文件的 URL”以https://companyname.jfrog.io/artifactory/repo-name-local/ 給出。
我希望這三個 PowerShell 命令能夠成功執行:
# Start with a clean nuget.config
git checkout nuget.config
# Add package source, username, password
.\nuget.exe sources add -name "Artifactory" -source https://companyname.jfrog.io/artifactory/api/nuget/repo-name-local/ -username foo -password bar -configfile .\nuget.config
# Restore packages
.\nuget.exe restore -Source "https://companyname.jfrog.io/artifactory/api/nuget/repo-name-local/;https://www.nuget.org/api/v2" -ConfigFile .\nuget.config -Verbosity detailed .\Something\Something.sln
前兩個命令成功執行,但第三個給出以下響應:
WARNING: Unable to find version '31.3.0.1035' of package 'GemBox.Spreadsheet'.
C:\Users\rdepew\.nuget\packages\: Package 'GemBox.Spreadsheet.31.3.0.1035' is not found on source 'C:\Users\rdepew\.nuget\packages\'.
https://companyname.jfrog.io/artifactory/api/nuget/repo-name-local/: Package 'GemBox.Spreadsheet.31.3.0.1035' is not found on source 'https://companyname.jfrog.io/artifactory/api/nuget/repo-name-local/'.
https://www.nuget.org/api/v2: Package 'GemBox.Spreadsheet.31.3.0.1035' is not found on source 'https://www.nuget.org/api/v2'.
我認為修改后的 URL 是必需的,但也許不是。 所以我稍微改變了命令:
# Start with a clean nuget.config
git checkout nuget.config
# Add package source, username, password
.\nuget.exe sources add -name "Artifactory" -source https://companyname.jfrog.io/artifactory/repo-name-local/ -username foo -password bar -configfile .\nuget.config
# Restore packages
.\nuget.exe restore -Source "https://companyname.jfrog.io/artifactory/repo-name-local/;https://www.nuget.org/api/v2" -ConfigFile .\nuget.config -Verbosity detailed .\Something\Something.sln
響應略有不同,但仍然不成功:
WARNING: Unable to find version '31.3.0.1035' of package 'GemBox.Spreadsheet'.
C:\Users\rdepew\.nuget\packages\: Package 'GemBox.Spreadsheet.31.3.0.1035' is not found on source 'C:\Users\rdepew\.nuget\packages\'.
https://companyname.jfrog.io/artifactory/repo-name-local/: Failed to fetch results from V2 feed at 'https://companyname.jfrog.io/artifactory/repo-name-local/FindPackagesById()?id='GemBox.Spreadsheet'&semVerLevel=2.0.0' with following message : Response status code does not indicate success: 404 (Not Found).
Response status code does not indicate success: 404 (Not Found).
https://www.nuget.org/api/v2: Package 'GemBox.Spreadsheet.31.3.0.1035' is not found on source 'https://www.nuget.org/api/v2'.
為什么nuget restore
命令都失敗了? 為什么他們看不到存儲庫內容?
我遇到了類似的問題,通過為 nuget repo 啟用強制身份驗證來解決。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.