1
votes

I have the below publish file which I use to publish my database project. I wanted to know if it possible to disable running pre-deployment and post-deployment scripts during publish.

<?xml version="1.0" encoding="utf-8"?>
  <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
      <IncludeCompositeObjects>True</IncludeCompositeObjects>
      <TargetDatabaseName>MyTestDB</TargetDatabaseName>
      <DeployScriptFileName>MyScript.sql</DeployScriptFileName>
      <TargetConnectionString>Data Source=127.0.0.1;Integrated Security=True;Pooling=False; </TargetConnectionString>
      <ProfileVersionNumber>1</ProfileVersionNumber>
    </PropertyGroup>
   </Project>

I don't want to modify the script files. I want to know if it can be done through configuration by specifying it in publish.xml file.

1

1 Answers

1
votes

You can modify your pre- and post-deployment script files to conditionally run based on a SQLCMD variable, then set the SQLCMD variable accordingly in your publish files.

Unfortunately I'm not sure of the XML schema for including SQLCMD variables in the publish file but you should be able to figure it out by playing with the UI. This page may be helpful.