title: Build NuGet Package automatically including referenced dependencies
body: <p>I want to <a href="http://haacked.com/archive/2011/03/31/hosting-simple-nuget-package-feed.aspx" rel="noreferrer">run a local/internal NuGet repository</a>.  I think I've figured out how to "reuse" existing NuGet packages by including them in a dummy project using NuGet and scanning the package file to <a href="http://www.hanselman.com/blog/HowToAccessNuGetWhenNuGetorgIsDownOrYoureOnAPlane.aspx" rel="noreferrer">grab my locally-cached <code>.nupkg</code> files</a>, but...</p>
  
  <h2>How do you create a nuget package (<code>.nupkg</code>) from a project, automatically including <strong>all</strong> <code>dll</code> dependencies and not just those grabbed via NuGet?</h2>
  
  <p>Specifically:</p>
  
  <ol>
  <li>Create a solution</li>
  <li>Add a new Project</li>
  <li>Add references to various <code>.dll</code> files/other projects <em>&lt;-- this is the missing part</em></li>
  <li>Add NuGet packages via package manager / cmdline / whatever</li>
  <li><em>something</em> automatically creates the <code>.nupkg</code></li>
  </ol>
  
  <p>From what I've found, you're supposed to do things like</p>
  
  <ul>
  <li>manually edit your <code>.csproj</code> file to add <code>&lt;BuildPackage&gt;true&lt;/BuildPackage&gt;</code> to include dependencies</li>
  <li>manually create a <code>.nuspec</code> file and manually <a href="http://docs.nuget.org/docs/reference/nuspec-reference#Specifying_Dependencies_in_version_2.0_and_above" rel="noreferrer">list your dependencies</a> (<a href="https://stackoverflow.com/questions/12819868/nuget-packaging-and-referencing-dlls">similar ?</a>)</li>
  <li>manually run <code>nuget pack</code> on your <code>.nuspec</code> file</li>
  </ul>
  
  <p>But everything is manual, which is stupid.  Even the semi-automatic solutions are still awkward or half-manual:</p>
  
  <ul>
  <li><a href="http://www.xavierdecoster.com/post/2012/04/27/install-package-nuspec-aspx" rel="noreferrer">Create <code>.nuspec</code> templates</a> - doesn't seem to include dependencies, just metadata</li>
  <li><p><a href="https://stackoverflow.com/questions/9180904/automating-creating-nuget-package-as-part-of-build-process">nuget pack via build-event</a> (step #5), which you need to add manually to every project, and it has <a href="https://stackoverflow.com/questions/14982266/the-replacement-token-description-has-no-value">its own quirks</a>:</p>
  
  <pre><code>"$(SolutionDir).nuget\NuGet.exe" pack "$(ProjectPath)" -Properties Configuration=Release
  move /Y *.nupkg "$(TargetDir)"
  </code></pre></li>
  </ul>
  
  <p>I'll settle for something that automatically creates a <code>.nuspec</code> manifest from project references.  Then theoretically that + the nuget build-event can be rolled up into a build-project/nuget package, which is what I really want to see.</p>