1

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 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.