TFS 2010: run powershell script stored in source control

做~自己de王妃 提交于 2019-12-23 03:02:08

问题


We've started using TFS2010 over at the company I work at. We create e-commerce web applications (shopping sites). I'm creating a custom template to deploy web projects after a build using a build template. I've looked at the web deploy tool, but MSDN seems to indicate that it can only do initial deployments, and I need to be able to do incremental deployments with the same script.

I'm thinking of using the invokeActivity activity in the template to use powershell to do the job by specifying an FTP script which automatically copies the output of a build to a designated FTP site and then runs the SQL (upgrade) scripts, if needed by using SSH or s powershell remoting interactive session. (possibly specified in a separate SQL script)

There is some unknown for me which I can't get clear through the use of google:

When queuing a build, will I be able to let the user specify a script present in source control ( e.g. $(source)\scripts\ftpscript.ps1 ) as the script which is to be used? Will powershell be able to access/use that file? or should I copy it to the build directory and specify when I run it? (I don't know how to set up the template to get files from source control, so a pointer to some helpful info how to do that would be very much appreciated)

If the previous just doesn't work at all, could I create a folder \scripts\ in my website project, commit that to source control and then use BuildDetail.DropLocationRoot & "\scripts\" as the location for the script and fore a copy of the script files by enabling the force copy option?


回答1:


To run a PowerShell script I think you can use the InvokeProcess activity which would trigger something like this: %windir%\system32\windowspowershell\v1.0\powershell.exe "$(SolutionRoot)\test.ps1

And yes, you can reach a script file present in source control using the "SourcesDirectory" keyword.



来源:https://stackoverflow.com/questions/6278804/tfs-2010-run-powershell-script-stored-in-source-control

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