1

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?

Onno
  • 295
  • 3
  • 21
  • Did you ever figure this out? I'm having this exact trouble – Nerd in Training Sep 04 '14 at 20:12
  • @NerdinTraining I'm sorry to say that I was unable to complete this. Ultimately, the company didn't have anyone who was capable of supporting me in acquiring the knowledge and I had to drop some of the planned features. In this case it was simplified to a InvokeProcess of web deploy, which greatly simplified the deployment, but also cut on the ability to run checking scripts easily. (sorry for the late response) – Onno Sep 29 '14 at 19:14

1 Answers1

3

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.

e-mre
  • 3,305
  • 3
  • 30
  • 46
  • I would also add -NoProfile and -NonInteractive to the Powershell arguments e.g. `"-NonInteractive -NoProfile -Command ""& {" + SourcesDirectory + "\Build\MakeSdkZip.ps1 " + SourcesDirectory + " " + ZipPath + " }"""` – Keith Hill Jun 08 '11 at 20:14