發問發問
 

已答覆A question about "setvar" and deployment

  • 2009年6月30日 下午 06:10Daniel Pratt 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    It seems that if I want to be able to deploy changes to a database from a project (via the "Deploy" action), I have to live with the fact that there will be hard-coded ":setvar" statements in the generated script to set the target database. Is this correct?

    I ask because the script takes quite a while to generate and I have a high degree of confidence that the generated script will be appropriate for other databases as well. Thus I want to re-use the script, supplying a different database as a parameter to SQLCMD.

    I see that there is an option to "comment out" the ":setvar" statements, which would allow me to specify a value for those parameters via SQLCMD. Unfortunately, this also prevents the "Deploy" target of the project from being able to automatically update the target database.

    If there is a way that I can have my cake and eat it too, please let me know :)

    Thanks,
    Daniel

解答

  • 2009年6月30日 下午 07:20Barclay HillMSFT, 版主使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     已答覆
    Daniel,

    You can have your cake and eat it too.  Database.sqldeployment options can be customized per configuration.  This will allow you to deploy with setvars for DEBUG and deploy to script without setvars for Release or however you want to define your configurations.

    Thanks,
    Barclay Hill Program Manager VSTS: DB Team (DataDude, DBPro, Database Edition) Please mark the responses as answer if it resolves your question.

所有回覆

  • 2009年6月30日 下午 07:20Barclay HillMSFT, 版主使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     已答覆
    Daniel,

    You can have your cake and eat it too.  Database.sqldeployment options can be customized per configuration.  This will allow you to deploy with setvars for DEBUG and deploy to script without setvars for Release or however you want to define your configurations.

    Thanks,
    Barclay Hill Program Manager VSTS: DB Team (DataDude, DBPro, Database Edition) Please mark the responses as answer if it resolves your question.