powershell Nuget restore命令行响应在源- Artifactory云服务器上未找到包

vxf3dgd4  于 2023-03-18  发布在  Shell
关注(0)|答案(1)|浏览(125)

我知道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命令都失败了?为什么它们看不到存储库内容?

hmae6n7t

hmae6n7t1#

我遇到了一个类似的问题。我通过为NuGet存储库启用“强制身份验证”选项来解决它。

相关问题