Naeem Sarfraz
Naeem Sarfraz

Reputation: 7430

Error running powershell task in TFS Build vnext

I have a very simple script which spits out environment variables like this:

Write-Host "SYSTEM_TEAMPROJECT: $ENV:SYSTEM_TEAMPROJECT"

My build has one step, the PowerShell task. The task script filename is set to the path to the script in TFSVC e.g. $/Main/BuildProcessTemplates/AllProps.ps1.

When I queue a new build it fails reporting the following error: "The term 'C:\Builds\agent_work\cb535ea3\Main' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."

Have I configured the task incorrectly?

-- UPDATE: Here's a copy of the powershell task View of PowerShell Task

Upvotes: 4

Views: 2655

Answers (1)

Naeem Sarfraz
Naeem Sarfraz

Reputation: 7430

Under the repository tab you need to include the script like below. If you have a directory of scripts you can select the folder instead.

enter image description here

Upvotes: 5

Related Questions