Using an existing publish profile when generating a script via sqlpackage.exe RRS feed

  • Question

  • Hi all - I am trying to use the data tools to automate applying changes to an existing target.  I am doing this by building an existing project/solution via MSBuild to create a .dacpac and then rate a change script.  Sqlpackage will then create a change script for me by comparing the two.  Here is a simplified version of the command line options -

    sqlpackage.exe /Action:Script /SourceFile:"C:\Test\bin\Debug\Test.dacpac" /TargetServerName:localhost\DenaliRC0 /TargetDatabaseName:deploy_Test
    /op:"C:\Test\bin\Debug\Test.dacpac.ChangeScript.sql"  /v:DataFileSize="50" /v:LogFileSize="5"

    This works however I am trying to determine if there is a way to simplify this more by using a publish profile I have saved via the VS GUI instead of manually putting in all of the command line parameters. 

    For example within the GUI I can right mouse click on a project and choose publish.  From within that dialogue I can choose to load/save a Profile which contains the Target DB connection, database name, publish script name and any number of SQLCMD variables (see example below).  I can then choose to 'Generate Script' which will use the loaded profile.  It would be really nice to be able to use one of these profiles through sqlpackage.exe. 

    Does anyone know how to use a saved profile with sqlpackage.exe?   I cannot find any documented parameters that accept a saved profile as an option.  The only option I see for me is to generate the command line parameters dynamically by manually parsing the XML myself.

    This is the option in the GUI to use an existing profile.

    Monday, February 27, 2012 7:56 PM


All replies