如何根据从TFS构建定义生成的构建环境重命名MSI文件?

时间:2022-10-14 22:40:40

I have created 2 different build definitions pointing to the same solution file .

我创建了两个指向同一解决方案文件的不同构建定义。

  1. QA environment.
  2. QA环境。
  3. Production environment.
  4. 生产环境。

Output of the solution generates installer files say 'xyz.msi' for both build definitions.

解决方案的输出生成安装程序文件,对两个构建定义都说'xyz.msi'。

Problem : I need to rename these msi files according to environment something like 'xyz.QA.msi' and 'xyz.Production.msi'.

问题:我需要根据环境重命名这些msi文件,例如'xyz.QA.msi'和'xyz.Production.msi'。

What is the best way to do it? is it possible by modifying the tfs build template? or any other easy and quick solution?

最好的方法是什么?可以通过修改tfs构建模板吗?或任何其他简单快捷的解决方案?

1 个解决方案

#1


1  

Add an invoke process to call a batch file that will do rename

添加调用进程以调用将重命名的批处理文件

so the contents of the bat file is something like

所以bat文件的内容是这样的

rename xyz.msi xyz.QA.msi

or create a custom activity to do the same thing

或创建一个自定义活动来做同样的事情

you could make it generic by adding an argument value that contains your environment name and then set the value in the build definition screen, you could then pass the environment name as an argument to batch / custom activity so you would end up with

您可以通过添加包含您的环境名称的参数值使其成为通用,然后在构建定义屏幕中设置该值,然后您可以将环境名称作为参数传递给批处理/自定义活动,这样您最终会得到

SET ENV=%1
rename xyz.msi xyz.%ENV%.msi

#1


1  

Add an invoke process to call a batch file that will do rename

添加调用进程以调用将重命名的批处理文件

so the contents of the bat file is something like

所以bat文件的内容是这样的

rename xyz.msi xyz.QA.msi

or create a custom activity to do the same thing

或创建一个自定义活动来做同样的事情

you could make it generic by adding an argument value that contains your environment name and then set the value in the build definition screen, you could then pass the environment name as an argument to batch / custom activity so you would end up with

您可以通过添加包含您的环境名称的参数值使其成为通用,然后在构建定义屏幕中设置该值,然后您可以将环境名称作为参数传递给批处理/自定义活动,这样您最终会得到

SET ENV=%1
rename xyz.msi xyz.%ENV%.msi