How to include directories recursively in NuSpec file

kyleb picture kyleb · Jun 16, 2014 · Viewed 14.6k times · Source

I have a folder structure like this in my project...

Project/Folder1/Folder2
-File1
-File2
-File3

Project/Folder1/Folder3
-File4
-File5
-File6

Project/Folder1/Folder4
-File7
-File8

In a NuSpec definition file, how can I tell it to include everything under Folder1 (folders and files recursively)?

Can I just do this or do I need a double ** or what?

<file src="Project\Folder1\*.*" target="Project/Folder1" />

Answer

Matt Ward picture Matt Ward · Jun 16, 2014

You can use the wildcard ** which is documented on the NuGet web site. From the NuGet docs:

Using a double wildcard, **, implies a recursive directory search.

<file src="tools\**\*.*" exclude="**\*.log" />
<file src="lib\**" target="lib" />