title: Nuget Powershell: how to add native dependencies? how to add files to a project inside a folder?
body: <p>I'm creating a Nuget package that has native dependencies. I put them inside the package without problems by specifying additional <code>file</code> entries in the <code>.nuspec</code> file.</p>
  
  <p>However, I also want to copy these to the output folder of the project that is going to use my package, so that the dependencies can be found at runtime.</p>
  
  <p>My idea is to add the native dependencies to the project and set their <code>BuildAction</code> to <code>CopyToOutputDirectory</code>. This I have also managed with the PowerShell script below:</p>
  
  <pre><code>param($installPath, $toolsPath, $package, $project)
  
  Function add_file($file)
  {
      $do_add = 1
      foreach($item in $project.DTE.ActiveSolutionProjects[0].ProjectItems)
      {
         if ($item -eq $file)
         { $do_add = 0 }
      }
      if ($do_add -eq 1)
      {
          $added = $project.DTE.ItemOperations.AddExistingItem($file)
          $added.Properties.Item("CopyToOutputDirectory").Value = 2
         $added.Properties.Item("BuildAction").Value = 0        
      }
  }
  add_file(&lt;dependency1&gt;)
  add_file(&lt;dependency2&gt;)
  ...
  add_file(&lt;dependencyN&gt;)
  </code></pre>
  
  <p>So far so good.</p>
  
  <p>But, now my project becomes completely polluted with these dependencies. </p>
  
  <p>Is there a way to add files to a project using PowerShell and put them inside a folder?<br>
  Or is there another way to achieve what I want: adding native dependencies to a NuGet package and outputting them to the bin-folder of the project using my Nu-package?</p>