Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Working folder issue in Powershell script in TFS build system

I have setup a build definition in Visual Studio Team Services (was Visual Studio Online) builds.

Below is a snapshot of Powershell script setup: enter image description here

I haven't set anything in 'Working folder' as I am assuming that it defaults to the folder where the script lives as specified in the info.

When build runs, it throws an exception at the Powershell step.

Below is the error snapshot: enter image description here

Somehow the working folder is not the folder where the script is located. Any suggestions to fix it?

like image 498
Sundeep Avatar asked May 12 '26 16:05

Sundeep


1 Answers

Use the powershell variable $PSScriptRoot to get the directory where your script is, and use that to figure out all other paths.

like image 95
Dylan Smith Avatar answered May 15 '26 15:05

Dylan Smith