JFrog Artifactory虚拟仓库无法检索关联本地仓库的NuGet包问题
JFrog Artifactory NuGet包虚拟仓库检索失败问题
问题现象
已部署到本地NuGet仓库的包,无法通过关联的虚拟仓库检索到,但本地仓库本身可正常检索:
- 执行
nuget search -s SourceLocalRepo -PreRelease可正常查到已构建/部署的包 - 针对虚拟仓库执行相同命令时提示
No results found
怀疑原因
- 本地仓库的文件结构/布局不符合规范
- 虚拟仓库的配置或权限问题
NuGet仓库布局疑问
请问Artifactory的NuGet仓库应采用以下哪种布局?
选项1:将*.nupkg直接放在仓库根目录
. ├── grpc.core.api.2.52.0.nupkg ├── grpc.net.client.2.52.0.nupkg └── grpc.net.common.2.52.0.nupkg 1 directory, 3 files
选项2:遵循NuGet客户端导出的层级布局
. ├── grpc.core.api │ └── 2.52.0 │ ├── _rels │ ├── grpc.core.api.2.52.0.nupkg │ ├── grpc.core.api.2.52.0.nupkg.sha512 │ ├── grpc.core.api.nuspec │ ├── lib │ │ ├── net462 │ │ │ ├── Grpc.Core.Api.dll │ │ │ ├── Grpc.Core.Api.pdb │ │ │ └── Grpc.Core.Api.xml │ │ ├── netstandard1.5 │ │ │ ├── Grpc.Core.Api.dll │ │ │ ├── Grpc.Core.Api.pdb │ │ │ └── Grpc.Core.Api.xml │ │ ├── netstandard2.0 │ │ │ ├── Grpc.Core.Api.dll │ │ │ ├── Grpc.Core.Api.pdb │ │ │ └── Grpc.Core.Api.xml │ │ └── netstandard2.1 │ │ ├── Grpc.Core.Api.dll │ │ ├── Grpc.Core.Api.pdb │ │ └── Grpc.Core.Api.xml │ ├── package │ │ └── services │ │ └── metadata │ │ └── core-properties │ ├── packageIcon.png │ └── README.md ├── grpc.net.client │ └── 2.52.0 │ ├── _rels │ ├── grpc.net.client.2.52.0.nupkg │ ├── grpc.net.client.2.52.0.nupkg.sha512 │ ├── grpc.net.client.nuspec │ ├── lib │ │ ├── net5.0 │ │ │ ├── Grpc.Net.Client.dll │ │ │ ├── Grpc.Net.Client.pdb │ │ │ └── Grpc.Net.Client.xml │ │ ├── net6.0 │ │ │ ├── Grpc.Net.Client.dll │ │ │ ├── Grpc.Net.Client.pdb │ │ │ └── Grpc.Net.Client.xml │ │ ├── net7.0 │ │ │ ├── Grpc.Net.Client.dll │ │ │ ├── Grpc.Net.Client.pdb │ │ │ └── Grpc.Net.Client.xml │ │ ├── netstandard2.0 │ │ │ ├── Grpc.Net.Client.dll │ │ │ ├── Grpc.Net.Client.pdb │ │ │ └── Grpc.Net.Client.xml │ │ └── netstandard2.1 │ │ ├── Grpc.Net.Client.dll │ │ ├── Grpc.Net.Client.pdb │ │ └── Grpc.Net.Client.xml │ ├── package │ │ └── services │ │ └── metadata │ │ └── core-properties │ ├── packageIcon.png │ └── README.md └── grpc.net.common └── 2.52.0 ├── _rels ├── grpc.net.common.2.52.0.nupkg ├── grpc.net.common.2.52.0.nupkg.sha512 ├── grpc.net.common.nuspec ├── lib │ ├── net5.0 │ │ ├── Grpc.Net.Common.dll │ │ ├── Grpc.Net.Common.pdb │ │ └── Grpc.Net.Common.xml │ ├── net6.0 │ │ ├── Grpc.Net.Common.dll │ │ ├── Grpc.Net.Common.pdb │ │ └── Grpc.Net.Common.xml │ ├── net7.0 │ │ ├── Grpc.Net.Common.dll │ │ ├── Grpc.Net.Common.pdb │ │ └── Grpc.Net.Common.xml │ ├── netstandard2.0 │ │ ├── Grpc.Net.Common.dll │ │ ├── Grpc.Net.Common.pdb │ │ └── Grpc.Net.Common.xml │ └── netstandard2.1 │ ├── Grpc.Net.Common.dll │ ├── Grpc.Net.Common.pdb │ └── Grpc.Net.Common.xml ├── package │ └── services │ └── metadata │ └── core-properties └── packageIcon.png 39 directories, 56 files
补充信息
- 虚拟仓库同时关联了NuGet.org远程仓库,其中的包可正常检索
- 通过Artifactory的"Native browser"查看虚拟仓库文件列表,可看到本地仓库的包
- 已尝试重新索引本地仓库,但不确定虚拟仓库是否支持此操作
- 使用托管版Artifactory商业实例,无仓库管理权限,测试受限
- NuGet API v2和v3均出现此问题
解答与排查建议
仓库布局规范
Artifactory的NuGet本地仓库必须采用选项2的层级布局,即包名/版本号/相关文件的结构。Artifactory依赖这种规范布局来生成NuGet包索引,虚拟仓库的检索能力完全基于底层仓库的索引结果。如果直接将nupkg放在根目录(选项1),本地仓库可能通过文件扫描临时检索到,但虚拟仓库无法识别这种非规范结构的包索引,导致检索失败。
其他排查方向
- 联系管理员确认虚拟仓库的配置:检查本地仓库是否被正确添加到虚拟仓库的仓库列表中,且未被配置过滤规则
- 确认虚拟仓库的NuGet设置中,是否启用了对本地仓库包的索引同步
- 要求管理员检查虚拟仓库的权限配置,确保其拥有读取本地仓库索引的权限
- 建议管理员触发虚拟仓库的重新同步或索引刷新操作,因为本地仓库重新索引后,虚拟仓库可能需要手动同步索引数据
内容的提问来源于stack exchange,提问作者falken
相关产品推荐
相关产品推荐

