Get-TfsPendingChange logs “There are no pending changes.” during Build

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Get-TfsPendingChange logs “There are no pending changes.” during Build



Context



I am using TFS 2015 update 3's gated check-in functionality with a Build agent version 1.95.3 to try and run an exe on certain files that I am checking in. A powershell script is responsible for finding the files that are being checked-in, and for applying the exe on them. However...


TFS 2015 update 3


1.95.3



Problem


Add-PSSnapin Microsoft.TeamFoundation.PowerShell
Get-TfsPendingChange -Shelveset $Env:BUILD_SOURCETFVCSHELVESET



writes There are no pending changes. into the Build logs...


There are no pending changes.



The puzzling part is that, when I run those 2 lines with the actual (as in I-checked-they-are-the-same) values from either the server where the Build agent sits, either from the dev's computer :


Add-PSSnapin Microsoft.TeamFoundation.PowerShell
Get-TfsPendingChange -Shelveset xxx -Server yyy



I will get the list of files that were in gated check-in.



Investigated elements until now


-Server


Get-TfsPendingChange


##[error]Ignoring the /Server option.


cd C:


-Server


Get-TfsPendingChange -Shelveset $Env:BUILD_SOURCETFVCSHELVESET -Server $Env:BUILD_REPOSITORY_URI


Preserve my pending changes locally


true


false


Clean



Question



Does anyone know why I retrieve an empty list of files being checked-in through powershell during the gated check-in ; and how I could retrieve the correct list I want ?





Did you get any error during your build, what's the result if you manually run the powershell script on the build agent?
– PatrickLu-MSFT
Aug 9 at 10:13





I do not have any error during my build ; running manually the powershell script on the server where the build agent operates provides the correct list of files - but maybe that wasn't what you meant by running the powershell script on the build agent ?
– Minh-Tâm TRAN
Aug 9 at 11:33


running the powershell script on the build agent





Did you check if the value of $Env:BUILD_SOURCETFVCSHELVESET is correct?
– Eddie Chen - MSFT
Aug 13 at 7:49





Yes I did ; I logged it, copy/pasted it, and used it in my manual Get-TfsPendingChange -Shelveset xxx -Server yyy (with the logged server as well). It worked as long as I run it manually.
– Minh-Tâm TRAN
Aug 13 at 10:07


Get-TfsPendingChange -Shelveset xxx -Server yyy





It's hard for me to guess what happens here. But as a workaround, you can get the shelveset via Rest API or Client Library with Powershell
– Eddie Chen - MSFT
Sep 5 at 6:51









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS