问题
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