TFS 2010:按顺序执行不同的构建和命令行任务?
我使用 TFS 2010 的构建过程应该一个接一个地执行不同的任务,例如:
在解决方案中构建第一个项目
通过命令行执行 MSBuild(以发布项目)
通过命令行执行第 3 方工具(以混淆二进制文件)
在解决方案中构建第二个项目(InstallShield 项目)
我怎样才能实现这一目标?我可以在构建定义中定义多个项目,但如何在这些构建步骤之间调用多个命令行任务?以及构建定义中的 MSBuildArguments:这些参数是否适用于每个项目/解决方案的每个 msbuild 调用?
谢谢
康拉德
my build process with TFS 2010 should perform different task one after the other like:
Build 1st project in solution
Execute MSBuild via command line (to publish the project)
Execute a 3rd party tool via command line (to obfuscate the binaries)
Build a 2nd project in the solution (an InstallShield project)
How can I achieve this? I can define several project in the Build Definition but how can I invoke several command line task between these build steps? And the MSBuildArguments in the Build Definition: Are these arguments for every msbuild call for each project/solution?
Thanks
Konrad
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,您需要在构建定义中添加不同的
*.*proj
而不是一个大的*.sln
- 或者(甚至更好)构造多个*.sln
&命令他们在构建定义中进行构建。因此,您可以组织仅在构建中使用的
Project1.sln
、Project2.sln
等。除此之外,您还必须在构建过程模板中进行更改才能获得此结果。
默认情况下,您会得到类似的内容,它会在更大的
foreach
中执行每个设置的项目/解决方案:一个好方法是将其增强为一个序列,其中设置了所有自定义操作作为InvokeProcess活动:
显然,您必须在此处插入流程控制,以便
发布
&Dotfuscator
第一次执行(其中Project1.sln
构建),而ISDEV
执行第二次(其中Project2.sln< /code> 构建)。在下面的示例中,我使用了
switch
&打包发布
&新序列
中的Dotfuscator
。最后,你必须有某种计数器。最直接的选择是设置一个新的 Int32 变量,默认值 == 1,并在执行过程中手动增加它。在下面的示例中,这是在下部
Assign
中完成的:对
编译项目
的最终覆盖以及更改后的构建定义应该可以满足您的需求。At first, you need to add in your build definition the distinct
*.*proj
instead of one big*.sln
- or (even better) construct more than one*.sln
& order them to get build in the build definition.So you could organize a
Project1.sln
,Project2.sln
etc that are only used from the Build.In addition to that, you would have to make changes in the build process template to get this.
By default you get something like that, that executes each set project/solution within a bigger
foreach
:A good way would be to enhance this as a sequence, where all your custom action are set as
InvokeProcess
activities:Obviously, you would have to insert here a flow control, so that
Publish
&Dotfuscator
execute the first time (whereProject1.sln
gets build), whileISDEV
executes the second time (whereProject2.sln
gets build). In the sample below I used aswitch
& packedPublish
&Dotfuscator
in a newSequence
.Finally, you would have to have a counter of some sort. The most immediate option is to set a new Int32 Variable with default == 1 and increase it by hand during execution. In the sample below this is done in the lower
Assign
:This final override of
Complie the Project
, along with a changed Build Definition should get what you 're after.团队构建定义采用 sln 和 msbuild 项目文件的列表。您可以简单地将 InstallShield 项目拆分为它自己的解决方案(大多数开发人员可能不会拥有 InstallShield 的副本)并为步骤 2 和 3 编写一个 msbuild 目标文件。然后只需告诉您的构建定义来构建解决方案 1,目标文件和解决方案 2。
您还可以选择将解决方案 1 中的项目之一的构建后事件中的内容放入目标文件中。
我不会在工作流程中执行此操作。
The team build definition takes a list of sln's and msbuild project files. You can put simply split your InstallShield project out into it's own solution ( most developers won't have a copy of InstallShield anyways likely ) and write an msbuild targets file for steps 2 and 3. Then just tell your build definition to build solution 1, the targets file and solution 2.
You could also choose to put the stuff in the targets file in a postbuild event for one of the projects in solution 1.
I wouldn't do this in workflow.