How to get the SolutionPath in a PowerShell Post-built script for TFS2013?

喜夏-厌秋 提交于 2019-12-24 21:43:40

问题


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.

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 ?

Thank you.


回答1:


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.

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 - Project-specific targets for solution does not work

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}


来源:https://stackoverflow.com/questions/29897030/how-to-get-the-solutionpath-in-a-powershell-post-built-script-for-tfs2013

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