我知道 NuGet 包就在那里。我可以在我的 Artifactory 页面上列出它们。为什么我的 nuget Restore
命令看不到它们?
我在 JFrog Artifactory 有一台服务器。假设 URL 是 https://companyname.jfrog.io/artifactory .
我在该位置有一个 NuGet 包存储库。该存储库称为“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 存储库的“强制身份验证”选项解决了这个问题。
关于powershell - Nuget 恢复命令行响应在源上找不到包 - Artifactory 云服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67644321/