Run the Powershell script, which is in the TFS source control

I am trying to run a Powershell script during my build process, but I cannot figure out how to access the ps1 file, which is checked in the original control (TFS 2010). There is a similar SO question that exists, but I'm not really sure if it is correct:

TFS 2010: run powershell script saved in source control

My TFS control source is configured as such:

=
Project == BuildScripts
=== MyScript.ps1
== Code
=== Dir1
==== MySolution.sln

I thought of passing something like SourcesDirectory + "\..\..\MyScript.ps1"(tell Powershell where the script is located), but I think I'm somewhere there.

Can someone help me figure out how to link to the ps1 file and run it?

+5
source share
1 answer

You will need to install Workspace in your assembly definition, including the directory with the Powershell script.

So your mapping might look like this:

*Server*                    *Workspace*
$/Project/Code/Dir     -    $(SourcesDir)

You will need to add:

*Server*                    *Workspace*
$/Project/Code/Dir     -    $(SourcesDir)
$/Project/BuildScripts -    $(SourcesDir)/BuildScripts

Your InvokeProcess can then pass Path.Combine(SourceDirectory, "BuildScripts", "MyScript.ps1")Powershell to the command line.

NB You can also set the workspace $/Project/Code/Dirto $(SourcesDir)/Code.

+4
source

All Articles