能否控制Artifactory中本地仓库顺序?NuGet重复包返回规则咨询
NuGet Package Resolution in Artifactory Virtual Repositories
Great question! Let me break down exactly how this works based on hands-on experience with Artifactory and NuGet:
What happens when duplicate packages exist in local repositories?
- When two local repositories in your virtual repo contain identical NuGet packages (same ID and exact version), Artifactory follows a strict priority rule for resolution. During
nuget restoreor direct package pulls, the client will receive the package from the highest-priority local repository in your virtual repo's configuration. - Important callout: This only applies to packages with matching IDs and versions. If versions differ, Artifactory will return all available versions (sorted by NuGet's standard versioning rules) regardless of repository order.
Does reordering local repositories affect which package is returned?
- Absolutely! The drag-and-drop order you set in the Artifactory UI for local repositories within the virtual repo directly defines their priority. When duplicate same-version packages exist, Artifactory will only return the package from the repository that appears first (topmost) in the list.
- As a side note: By default, remote/cache repositories (like your public NuGet cache) have lower priority than local repositories. So if a local repo has the package, Artifactory will never fall back to the cache for that specific package version.
Quick verification tip
You can test this behavior directly with the NuGet CLI to confirm which package Artifactory resolves to:
nuget list <Your-Package-Id> -Source <Your-Virtual-Repo-URL>
The output will show the package from the highest-priority repository, matching the order you set in the UI.
内容的提问来源于stack exchange,提问作者red888
相关产品推荐
相关产品推荐

