TFS 2015 Build vNext recursive variable substitution

本小妞迷上赌 提交于 2019-12-08 05:34:07

问题


Is it possible that the variable substitution is not recursive?

Example1:

Variable Value

SqlInstance (localDb)\mssqllocaldb

DbCatalogName FooDb

ConnStr data source=$(SqlInstance);initial catalog=$(DbCatalogName)$(Build.BuildId);

During the build the connection string substituted to: data source=(localDb)\mssqllocaldb;initial catalog=FooDb3211;

This configuration works perfectly. But if i move the BuildId parameter to DbCatalogName variable it won't be substituted.

Example2:

Variable Value

SqlInstance (localDb)\mssqllocaldb

DbCatalogName FooDb$(Build.BuildId)

ConnStr data source=$(SqlInstance);initial catalog=$(DbCatalogName);

With this configuration the connection string is substituted to: data source=(localDb)\mssqllocaldb;initial catalog=FooDb$(Build.BuildId);

So how can i chain variables with vNext?


回答1:


If you want the "DbCatalogName" variable contain the BuildID value, I recommend you to add an additional power-shell build step to set the value of "DbCatalogName".

The code to set a variable value:

##vso[task.setvariable variable=testvar;]testvalue



回答2:


Variable chaining seems to work with TFS 2015 Update 3.



来源:https://stackoverflow.com/questions/35266592/tfs-2015-build-vnext-recursive-variable-substitution

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!