开发者

How to make database name a parameter on deploymanifest?

开发者 https://www.devze.com 2023-04-02 04:46 出处:网络
I am trying to customize default TFS build process by adding a step where a database is deployed using the database project. I followed [these steps][1] and the DB deployment works when the database n

I am trying to customize default TFS build process by adding a step where a database is deployed using the database project. I followed [these steps][1] and the DB deployment works when the database name is hard code on the deploymanifest file on this step under InvokeProce开发者_运维问答ss.

c. Set the Arguments property to "/a:Deploy /dd+ /dsp:Sql /manifest:DatabaseProjectName.deploymanifest". You must replace DatabaseProjectName with the name of the database project that you want to deploy.

My question is, how can I change DatabaseProjectName to a variable and have it assigned dynamically so this BuildProcessTemplate can be used by other database builds or if the project is branched within TFS? I tried using the $(DatabaseName) variable used in SQLCmdVars with the project properties, but it does not seem to resolve.


First, you can make the DatabaseProjectName a variable in your build definition by modifying the definition template to add the "DatabaseProjectName" (and "TargetDatabaseName" if the name of the db is going to be different) as Arguments. You can click in the Metadata property to expose the properties so you can set it to different names in each build definition. See this post on adding arguments. http://www.ewaldhofman.nl/post/2010/04/27/Customize-Team-Build-2010-e28093-Part-2-Add-arguments-and-variables.aspx

Then, use the arguments in your InvokeProcess activity as variables in the string like below. You can override the database name in the manifest by including the /p:TargetDatabase option.

/a:deploy /dd+ /dsp:sql /manifest:" & DatabaseProjectName & ".deploymanifest /p:TargetDatabase=" & TargetDatabaseName
0

精彩评论

暂无评论...
验证码 换一张
取 消