Note that there are some explanatory texts on larger screens.

plurals
  1. POPackaging SQL files only using Nuget.exe
    primarykey
    data
    text
    <p>Is there a way to package a folder of only .SQL files instead of having to add them to a project using Nuget.exe? </p> <p>I know you can specify folders inside the nuspec, but what is the process of doing so? I've only been able to make packages from using .net project/applications.</p> <p>For example, If I create a nuspec inside called Database.nuspec</p> <pre><code>F:\folder\trunk\Source\Database.nuspec </code></pre> <p>inside the folder </p> <pre><code>F:\folder\trunk\Source\Database </code></pre> <p>and I want to package up my patch scripts folder </p> <pre><code>F:\folder\trunk\Source\Database\Patch Scripts </code></pre> <p>and inside that folder I had</p> <pre><code>F:\folder\trunk\Source\Database\Patch Scripts\2.0 F:\folder\trunk\Source\Database\Patch Scripts\2.1 F:\folder\trunk\Source\Database\Patch Scripts\2.2 </code></pre> <p>Would I need to include these folders inside of my nuspec or is nuget.exe smart enough to package them up for me? E.G</p> <p>Update:</p> <p>Solution 1: would be to include each folder to the nuspec</p> <pre><code>&lt;files&gt; &lt;file src="F:\folder\trunk\Source\Database\*.sql" target="Database" /&gt; &lt;file src="F:\folder\trunk\Source\Database\Patch Scripts\*.sql" target="Database\Patch Scripts\" /&gt; &lt;file src="F:\folder\trunk\Source\Database\Patch Scripts\2.0\*.sql" target="Database\Patch Scripts\2.0" /&gt; &lt;/files&gt; </code></pre> <p>But I have a lot of patch files and it will be quite tedious to write out about 40 into a nuspec, I will update if I find a work around.</p> <p>Solution 2: ufuk-haciogullari suggested using</p> <pre><code> *\*.sql </code></pre> <p>as the source since they are one level down, and this does what I want, but I need to keep the file structure intact, If i were to just write </p> <pre><code>&lt;files&gt; &lt;file src="F:\folder\trunk\Source\Database\*.sql" target="Database" /&gt; &lt;file src="F:\folder\trunk\Source\Database\Patch Scripts\*\*.sql" target="Database\Patch Scripts" /&gt; &lt;/files&gt; </code></pre> <p>it will store all the returns into the target Database\Patch Scripts\ and this isn't the structure I want.</p> <p>Update:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"&gt; &lt;metadata&gt; &lt;id&gt;database&lt;/id&gt; &lt;version&gt;1.0.6&lt;/version&gt; &lt;authors&gt;me&lt;/authors&gt; &lt;description&gt;Description&lt;/description&gt; &lt;/metadata&gt; &lt;files&gt; &lt;file src="F:\folder\trunk\Source\Database\*.sql" target="Database\" /&gt; &lt;file src="F:\folder\trunk\Source\Database\Patch Scripts\**\*.sql" target="Database\Patch Scripts" /&gt; &lt;/files&gt; </code></pre> <p></p> <p>This packages my solution and stores the files as they were in the previous format.</p> <pre><code>nuget.exe pack "F:\folder\trunk\Source\Database\database.nuspec" -OutputDirectory F:\NuGetStore </code></pre> <p>UPDATE:</p> <p>Coming back to this, if you leave the target blank in it will re-create the same folder structure that is already in place, so you don't need to create directories. </p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"&gt; &lt;metadata&gt; &lt;id&gt;database&lt;/id&gt; &lt;version&gt;1.0.6&lt;/version&gt; &lt;authors&gt;me&lt;/authors&gt; &lt;description&gt;Description&lt;/description&gt; &lt;/metadata&gt; &lt;files&gt; &lt;file src="F:\folder\trunk\Source\Database\*.sql" target="" /&gt; &lt;file src="F:\folder\trunk\Source\Database\Patch Scripts\**\*.sql" target="" /&gt; &lt;/files&gt; </code></pre> <p></p> <p>This packages my solution and stores the files.</p> <pre><code>nuget.exe pack "F:\folder\trunk\Source\Database\database.nuspec" -OutputDirectory F:\NuGetStore </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload