locked
Only have Dacpac deployer deploy the necessary .dacpac files RRS feed

  • Question

  • We currently have a deployment process that involves the Dacpac Database Deployer component. The source is set as "\". 

    When we deploy, it transfer the entire contents of the release to the server. In our case, this is  nearly 780MB. All in order to get 57KB file onto a server. 

    How do we set it up so that it excludes all files other than the Dacpac files as a part of this component?

    Thursday, June 12, 2014 10:22 PM

Answers

  • Hi JP,  

    Thanks for your reply.

    The .dacpacs belong to the project in your solution or belong to your solution?

    If .dacpacs file existing in the root directory of your drop location, we should use the “\” in your component as you did.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, June 16, 2014 7:14 AM
    Moderator

All replies

  • Hi Joe,  

    Thanks for your post.

    The “\” mean the root of  build drop folder. If you want exclude other folders, I think you can try provide a specific path as Path to package value in your component, like set Path to package = [Build Drop Location]\xxx\xxx\Dapacfolder.

    For deploying Database using Release Management, you can refer to the useful information in this article: http://www.incyclesoftware.com/2014/03/deploying-databases-release-management/.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, June 13, 2014 6:53 AM
    Moderator
  • John-

    Thanks for the response. Sorry for the silly question, but how do I set up the build template to deploy the .dacpacs to a subfolder? As it is right now, even though they are in a subfolder in VS, they are deployed to the root directory of the drop location. 


    JP

    Friday, June 13, 2014 11:38 PM
  • Hi JP,  

    Thanks for your reply.

    The .dacpacs belong to the project in your solution or belong to your solution?

    If .dacpacs file existing in the root directory of your drop location, we should use the “\” in your component as you did.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, June 16, 2014 7:14 AM
    Moderator
  • Hi JP,

    A easy solution is to modify task: AfterBuild in file: <Database Project>.sqlproj 

    Steps:

    1. Right-click: <Database project> & select option: Properties
       a. Click option: Build
          1. Set field: Build Output File Name to value: <Database Name>
          2. Save
    2. Right-click: <Database Project> & select option: Unload Project
    3. Right-click: <Database Project> & select option: Edit <Database Project>
    4. Search for task: AferBuild
    5. Replace it with the following code:

      <Target Name="AfterBuild">
        <Copy SourceFiles="$(OutDir)\<Database Name>.dacpac" DestinationFiles="$(OutDir)\Databases\<Database Name>\<Database Name>.dacpac" />
        <Copy SourceFiles="$(OutDir)\<Database Name>.xml" DestinationFiles="$(OutDir)\Databases\<Database Name>\<Database Name>.xml" />
        <Copy SourceFiles="$(OutDir)\<Database Project>.dll" DestinationFiles="$(OutDir)\Databases\<Database Name>\<Database Project>.dll" />
        <Copy SourceFiles="$(OutDir)\<Database Project>.pdb" DestinationFiles="$(OutDir)\Databases\<Database Name>\<Database Project>.pdb" />
        <Copy SourceFiles="$(OutDir)\master.dacpac" DestinationFiles="$(OutDir)\Databases\<Database Name>\master.dacpac" />
      </Target>

      ATTENTION:
      
      1. You must include a DACPAC for every database reference ... In this example, the <Database Project> references database objects in database: Master
         If you do not include Master.dacpac then deployment of Analytics.dacpac will fail; because it can not find references to database: master

    If: 

      <Database Project> = Database.Analytics
      <Database Name> = Analytics

    Then:

      <Target Name="AfterBuild">
        <Copy SourceFiles="$(OutDir)\Analytics.dacpac" DestinationFiles="$(OutDir)\Databases\Analytics\Analytics.dacpac" />
        <Copy SourceFiles="$(OutDir)\Analytics.xml" DestinationFiles="$(OutDir)\Databases\Analytics\Analytics.xml" />
        <Copy SourceFiles="$(OutDir)\Database.Analytics.dll" DestinationFiles="$(OutDir)\Databases\Analytics\Database.Analytics.dll" />
        <Copy SourceFiles="$(OutDir)\Database.Analytics.pdb" DestinationFiles="$(OutDir)\Databases\Analytics\Database.Analytics.pdb" />
        <Copy SourceFiles="$(OutDir)\master.dacpac" DestinationFiles="$(OutDir)\Databases\Analytics\master.dacpac" />
      </Target>

    Drops the following files:

      \\<Build Server>\Builds\<Build Definitions>\<Build Number>\Databases\Analytics\Analytics.dacpac
      \\<Build Server>\Builds\<Build Definitions>\<Build Number>\Databases\Analytics\Analytics.xml
      \\<Build Server>\Builds\<Build Definitions>\<Build Number>\Databases\Analytics\Database.Analytics.dll
      \\<Build Server>\Builds\<Build Definitions>\<Build Number>\Databases\Analytics\Database.Analytics.pdb
      \\<Build Server>\Builds\<Build Definitions>\<Build Number>\Databases\Analytics\master.dacpac
      

    Carl Austom

    • Proposed as answer by Carl Austrom Tuesday, January 13, 2015 10:35 PM
    Tuesday, January 13, 2015 10:35 PM