문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top