change output directory of nuget package
<p>I created a NuGet package from my project. The output directory of the package is the solution directory. I would like to output it to a specific directory. I tried a target in the csproj file and in the nuspec file. None worked. How do I get the package generated in the specified folder?</p>

<p>In my .csproj:</p>

<pre><code>&lt;Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"&gt;
  &lt;PropertyGroup&gt;
    &lt;ErrorText&gt;This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.&lt;/ErrorText&gt;
  &lt;/PropertyGroup&gt;
  &lt;Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" /&gt;
&lt;/Target&gt;
</code></pre>

<p>In my .nuspec:</p>

<pre><code>&lt;?xml version="1.0"?&gt;
&lt;package &gt;
  &lt;metadata&gt;
    &lt;id&gt;MyPackage.dll&lt;/id&gt;
    &lt;version&gt;1.0.0&lt;/version&gt;
    &lt;authors&gt;me&lt;/authors&gt;
    &lt;owners&gt;me&lt;/owners&gt;
    &lt;requireLicenseAcceptance&gt;false&lt;/requireLicenseAcceptance&gt;
    &lt;description&gt;Package description&lt;/description&gt;
    &lt;releaseNotes&gt;Summary of changes made in this release of the package.&lt;/releaseNotes&gt;
    &lt;copyright&gt;Copyright 2016&lt;/copyright&gt;
    &lt;files&gt;
      &lt;file src="bin\MyPackage.dll" target="C:\LocalPackageRepository" /&gt;
    &lt;/files&gt;
  &lt;/metadata&gt;
&lt;/package&gt;
</code></pre>