如何在TFS2013的PowerShell后置脚本中获取SolutionPath? [英] How to get the SolutionPath in a PowerShell Post-built script for TFS2013?

查看:79
本文介绍了如何在TFS2013的PowerShell后置脚本中获取SolutionPath?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在TFS2013构建中,在构建定义的构建后路径中,我调用一个PowerShell脚本,该脚本需要获取之前构建的解决方案的路径.

In a TFS2013 build, in the Post-build path of the build definition, I call a PowerShell script which need to get the path of the Solution built just before.

但是,环境变量"中没有提供SolutionPath变量,因此我们无法在定义构建"的构建后参数"中传递此变量.

But the SolutionPath varibale is not provided in the Environment Variables and we can't pass this variable in the Post-Build Arguments in the Definition Build.

您有没有修改构建模板的提示吗?

Have you a tip for that without modify the build template ?

谢谢.

推荐答案

在我看来,tfbuild中没有SolutionPath变量的原因是因为您没有义务只在自己的系统中构建一个解决方案.构建过程.

The reason there isn't a SolutionPath variable in the tfbuild , in my opinion, is because there aren't any obligation you will only build one solution in your build process.

为了在完成构建的解决方案后运行脚本,您可以添加After..sln.targets并指定一个您可以完成的任务(

In order to run the script after the solution done with the build you could add an After..sln.targets and specify a task to do as you please (powershell task inside msbuild)

http://sedodream.com/2010/10/22/MSBuildExtendingTheSolutionBuild.aspx

MSBuild-解决方案的项目特定目标不起作用

另一个选择是:如果您想在根文件夹下找到相对路径,则可以在脚本内使用$env:TF_BUILD_SOURCESDIRECTORY,这将导致您进入构建的\src文件夹

Another option is: in case you want the relative path under your root folder, you could just use the $env:TF_BUILD_SOURCESDIRECTORY inside your script, which will lead you to the \src folder of your build

Get-ChildItem $env:TF_BUILD_SOURCESDIRECTORY | Where-Object FullName -Like "*.sln" | foreach {$_.FullName}

这篇关于如何在TFS2013的PowerShell后置脚本中获取SolutionPath?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆