NuGet.exe package not including empty folders
<p>I have created a nuspec file for my solution. The solution has a few empty folders.</p>

<p>I have downloaded the latest nuget.exe from <a href="https://docs.nuget.org/consume/command-line-reference" rel="nofollow">https://docs.nuget.org/consume/command-line-reference</a> </p>

<p>However when I run my nuget pack command the empty folders are not being included. Looking at the documentation for the pack command, I am interpreting the fact that empty folders are included by default because of this flag:</p>

<p>ExcludeEmptyDirectories: Prevent inclusion of empty directories when building the package.</p>

<p>Unfortunately I am not able to get the pack command to include my empty folders.</p>

<p>My files structure is similar to
Root</p>

<ul>
<li>Folder1  </li>
<li>Folder2</li>
<li>Folder3</li>
</ul>

<p>Folder1 and Folder2 have content files within them, but Folder3 is empty</p>

<p>My nuspec file defined as follows:</p>

<pre><code>&lt;?xml version="1.0"?&gt;
&lt;package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"&gt;
  &lt;metadata&gt;
    &lt;id&gt;Package_7.2_140526&lt;/id&gt;
    &lt;version&gt;7.2.140526&lt;/version&gt;
    &lt;title&gt;Package 7.2 rev 140526&lt;/title&gt;
    &lt;authors&gt;My Company&lt;/authors&gt;
    &lt;owners&gt;My Company&lt;/owners&gt;
    &lt;requireLicenseAcceptance&gt;false&lt;/requireLicenseAcceptance&gt;
    &lt;description&gt;A vanilla website&lt;/description&gt;
  &lt;/metadata&gt;
&lt;/package&gt;
</code></pre>

<p>I have not included individual files because I want the nuget pack to include everything. While my example is only of 3 folders there are significantly more than than.</p>

<p>This is the nuget command I am running from the command line</p>

<pre><code>nuget pack "c:\Projects\Package 7.2 rev 140526\Packagee 7.2 140526.nuspec" -OutputDirectory c:\Projects -NoPackageAnalysis 
</code></pre>

<p>When that did not work I tried with the -ExcludeEmptyDirectories flag just incase</p>

<pre><code>nuget pack "c:\Projects\Package 7.2 rev 140526\Packagee 7.2 140526.nuspec" -OutputDirectory c:\Projects -NoPackageAnalysis -ExcludeEmptyDirectories
</code></pre>

<p>But it still will not include the empty folder. </p>

<p>What needs to be done to get the nuget pack command to include the empty folders?</p>

<p><strong>Update</strong></p>

<p>I used the Nuget Package Explorer to add the empty folders to the solution and then looked in the modified nuspec file. It appears that the only way to include empty folders within nuget is to have a file entry as</p>

<pre><code>&lt;file src="folder3\_._" target="folder3\_._" /&gt;
</code></pre>

<p>And then have a postdeploy.ps1 file to delete all the files named "_._"</p>

<p>So it appears that will always have to specify the files.</p>

<p>Ps. I tested it with the following structure
\Folder3\Folder4. </p>

<p>If folder4 is empty then folder3 and folder4 are not created unless you include the "_._" file</p>

<p>But if there is a way to include empty folders without having to resort to _._ file then want to know, especially if the blank folder is nested as it is easy to get excluded</p>