Search code examples
msbuildmsdeploywebdeploy

msdeploy not running dbDacFx provider


I am trying to embed my dacpac file in the package and run the dbDacFx provider at deploy time.

using following visual studio 2010 with Azure publihsing tools and SSDT SQl Server 2008 R2 with wpp.targets file in my project.

The file looks like this ...

 <AfterAddIisAndContentDeclareParametersItems>
      $(AfterAddIisAndContentDeclareParametersItems);
      AddAdditionalAclsDeclareParameterItems;
      DeployUIConfigDatabase;
    </AfterAddIisAndContentDeclareParametersItems>
<Target Name="DeployUIConfigDatabase">
    <ItemGroup>
      <MsDeploySourceManifest Include="dbDacFx">
        <Description>Add dbDacFx $(_MSDeployDirPath_FullPath)\Database\%(CopyAdditionalFilesToDeploy.Identity) to Folder</Description>
        <Path>$(_MSDeployDirPath_FullPath)\Database\%(CopyAdditionalFilesToDeploy.Identity)</Path>
        <Dest>{UIConfigContext-Web.config Connection String</Dest>
        <IncludeTransactionalScripts>True</IncludeTransactionalScripts>
        <IncludeData>True</IncludeData>
        <AdditionalProviderSettings>IncludeData;IncludeTransactionalScripts</AdditionalProviderSettings>
      </MsDeploySourceManifest>
    </ItemGroup>
  </Target>

i can see that the .zip package has the dacpac file, but when i deploy it, the provider never gets invoked... Many thanks!


Solution

  • for anyone facing similar issue, looks like you also have to declare a parameter that gets used by msdeploy during deployment phase. Adding following to my wpp file produced the right parameter file and everything works now.

    <Target Name="AddAdditionalDeployUIConfigDatabase">
        <ItemGroup Condition="'@(CopyAdditionalFilesToDeploy)' != ''">
          <MsDeployDeclareParameters Include="Add dbDacFx Provider Parameter %(CopyAdditionalFilesToDeploy.Identity)">
            <Kind>ProviderPath</Kind>
            <Scope>dbDacFx</Scope>
            <Description>Run dbDacFx provider on %(CopyAdditionalFilesToDeploy.Identity)</Description>
            <DefaultValue>{UIConfigContext-Web.config Connection String}</DefaultValue>
            <DestinationContentPath>$(_MsDeployParameterNameForContentPath)/@(CopyAdditionalFilesToDeploy)</DestinationContentPath>
            <Tags>Hidden</Tags>
            <ExcludeFromSetParameter>True</ExcludeFromSetParameter>
          </MsDeployDeclareParameters>
        </ItemGroup>