I'm having issue with running a piece of PS code within a task within my pipeline. Provided below is the code:
cd C:\PowerShell
# Change directory to location where TF.exe is hosted on the server.
Set-Alias tf "C:\Program Files (x86)\Microsoft Visual Studio\2017\TeamExplorer\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\tf.exe"
#.\TF.exe vc workspace /new temp /noprompt /collection:https://dev.azure.com/organization/ProjectName/ /login:$userName,$password
#tf workfold
# Create the branch and check it in.
#.\TF.exe vc workspace /collection:https://dev.azure.com/organization/ProjectName/ /noprompt
tf vc branch $/HunterWidgets/BCWidgets "C:\AzureDevOps\HunterWidgets\$($newBranchName)" /checkin /login:$userName, $password
I'm attempting to create a brand new branch. Everything works fine when I run this inside of my console on my server, but when I run it within my pipeline task it get the following error:
##[error]tf : Unable to determine the workspace. You may be able to correct this by running 'tf workspaces
##[error]/collection:TeamProjectCollectionUrl'.
I'm not sure what is going on. Any help will be greatly appreciated.
Thank you,