title: Command-line Package Service Fabric Application
body: <p>Our continuous delivery set-up, until recently, was delivering Service Fabric packages using the following command:</p>
  
  <pre><code>msbuild SFApp.sfproj /t:Package
  </code></pre>
  
  <p>This was necessary because the target <em>Package</em> is unavailable at the solution level. I.e. The command</p>
  
  <pre><code>msbuild SFSolution.sln /t:Package
  </code></pre>
  
  <p>Fails, as the target does not exist.</p>
  
  <p>As our dependency mesh grows, it gets to a point in which most interfaces projects will not build without a solution file (<a href="https://stackoverflow.com/a/9087620/98029">to work around the "OutputPath does not exist" red herring</a>). There seems to be a way to do that <a href="https://stackoverflow.com/a/19534376/98029">according to this answer</a>. Unfortunately, while targets like <em>Clean</em> work…</p>
  
  <pre><code>msbuild SFSolution.sln /t:SFApplication:Clean
  (…snip…)
  Build succeeded.
      0 Warning(s)
      0 Error(s)
  </code></pre>
  
  <p>…the target Package won't!</p>
  
  <pre><code>msbuild SFSolution.sln /t:SFApplication:Package
  (…snip…)
  Build FAILED.
  "SFSolution.sln" (SFApplication:Package target) (1) -&gt; SFSolution.sln.metaproj :
          error MSB4057: The target "SFApplication:Package" does not exist in the
          project. [SFSolution.sln]
      0 Warning(s)
      1 Error(s)
  </code></pre>
  
  <p><em>(Solution/project folders/names omitted/paraphrased for clarity. I can provide the actual logs if necessary.)</em></p>
  
  <p>So the question is: how could I, using the Command Line, build <strong>one</strong> project using the <strong>Package</strong> target and the <strong>solution</strong> file?</p>
  
  <p><strong>Or</strong> how can I otherwise package a Service Fabric application from the command line?</p>