title: Stop SSDT being published when MSBuild publish run
body: <p>I have a ClickOnce project that I'm publishing on DevOps.  I've set the <code>MSBuild Arguments</code> property for the WinForm solution's build stage in DevOps to <code>/target:Publish</code> in order to trigger the creation of all the ClickOnce files:</p>
  
  <p><a href="https://i.stack.imgur.com/H0Ijw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/H0Ijw.png" alt="enter image description here"></a></p>
  
  <p>However, that solution also contains an SSDT project, and adding the <code>/target:Publish</code> setting appears to then cause the build process to try publish the SSDT too. That then fails with the error:</p>
  
  <blockquote>
    <p>C:\Program Files (x86)\Microsoft Visual
    Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(1808,5):
    error MSB4044: The "SqlPublishTask" task was not given a value for the
    required parameter "SqlPublishProfilePath"</p>
  </blockquote>
  
  <p>Presumably it's failing because there's no publish profile specified in a build parameter for the SSDT to use.  </p>
  
  <p>I don't want MSBuild to publish the DacPac to a server, I just want it to create the DacPac. How can I stop the <code>/target:Publish</code> triggering the SSDT publish, is there another build argument I can add to stop that happening?</p>
  
  <p><strong>Notes on what I tried so far to solve this, none of which has worked:</strong></p>
  
  <ul>
  <li>Read about the -target switch in the MS Build official docs <a href="https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-command-line-reference?view=vs-2017" rel="nofollow noreferrer">in the MSBuild command-line reference</a> and in the <a href="https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-targets?view=vs-2017" rel="nofollow noreferrer">MSBuild targets section</a>.</li>
  <li>Looked at the code in the .csproj file to try and identify the 'Publish' sections - think Publish must also call Build.</li>
  <li>Unticking Deploy for the SSDTs in the solution configuration in VS</li>
  <li>Adding entries for False in the Release and Deployment configurations in the SSDT's .csproj file, and also setting that to false for the Debug configuration (<a href="https://social.msdn.microsoft.com/Forums/sqlserver/en-US/9d1d54bc-171b-497b-9a77-53a6bf26ca36/whats-the-effect-to-deploytodatabase-in-sqlproj-file?forum=ssdt" rel="nofollow noreferrer">as per this question</a>)</li>
  <li>Setting MSBuild to only publish one project using the MS Build arguments on DevOps (<a href="https://stackoverflow.com/questions/16891530/publish-one-web-project-from-solution-with-msbuild">as per this answer</a>)</li>
  <li>Considered pulling the ClickOnce publish out into an entirely separate stage using Mage.exe as per this <a href="https://docs.microsoft.com/en-us/visualstudio/deployment/walkthrough-manually-deploying-a-clickonce-application?view=vs-2017" rel="nofollow noreferrer">Walkthrough: Manually deploy a ClickOnce application</a></li>
  <li>Tried to create a publish profile that doesn't actually publish, so that the publish stage can complete (<a href="https://stackoverflow.com/questions/10032213/making-ssdt-just-generate-a-sql-script-and-not-deploy-a-database">was looking at this question for ideas on that</a> and also the <a href="https://docs.microsoft.com/en-gb/sql/tools/sqlpackage?view=sql-server-2017" rel="nofollow noreferrer">official documentation for SqlPackage.exe</a>)</li>
  </ul>