To support a more manageable repository layout, you may store NuGet packages inside folders that correspond to the package structure.
Artifactory will find your packages by performing a property search so the folder hierarchy does not impact performance.
To use a hierarchical layout for your repository you should define a Custom Layout. This way, different maintenance features like version cleanup will work correctly with NuGet packages.
Read More: JFrog Artifactory and NuGet Repositories
Placing packages to match your repository layout
Defining a Custom Layout for your repository does not force you to place your packages in the corresponding structure, however it is recommended to do so since it allows Artifactory to perform different maintenance tasks, such as version cleanup, automatically.
It is up to the developer to correctly deploy packages into the corresponding folder. From NuGet 2.5 you can push packages into a folder source as follows:
nuget push mypackage.1.0.0.nupkg -Source http://10.0.0.14:8081/artifactory/api/nuget/nuget-local/path/to/folder
Below is an example of a Custom Layout named nuget-default.
In this example, the three fields that are mandatory for module identification are:
Organization =
orgPath
Module =
module
Base Revision (
baseRev
) is not a part of the layout hierarchy in this example, but it is included here as one of the required fields.
You can configure this Custom Layout as displayed in the image above, or simply copy the below code snippet into the relevant section in your Global Configuration Descriptor:
<repoLayout> <name>nuget-default</name> <artifactPathPattern>[orgPath]/[module]/[module].[baseRev](-[fileItegRev]).[ext]</artifactPathPattern> <distinctiveDescriptorPathPattern>false</distinctiveDescriptorPathPattern> <folderIntegrationRevisionRegExp>.*</folderIntegrationRevisionRegExp> <fileIntegrationRevisionRegExp>.*</fileIntegrationRevisionRegExp> </repoLayout>
Since the package layout is in a corresponding folder hierarchy, the Artifactory Version Cleanup tool correctly detects previously installed versions.