I have a TFS 2013 Update 2 buildserver. When I build a project, I checkout some files, alter some things and check it in again. This works great. The only problem is when someone has checkout one of those files, the buildserver will see that as an error and the build will be partially succeeded. Actually it is just an information message but the build sees it as an error. How can I suppress those messages?
I have the following Powershell command:
Add-TfsPendingChange -Edit -Item $PathToFolderToCheckout -Recurse
The command is from the TFS 2013 Power Tools.
I tried the following but it doesn't work:
-ErrorAction
with Igonore
and SilentlyContinue
-Out-Null
The message that is thrown for each file is: Path to file: opened for edit in Workspace;Ralph Jansen
Thanks
I believe it needs to be in the standard output stream to be sent to null. Try this:
$Null = Add-TfsPendingChange -Edit -Item $PathToFolderToCheckout -Recurse *>&1
*>&1 redirects all output to standard output and $null is a reserved variable for this purpose. It is more efficient than piping to out-null.
Another alternative could be to set the action preference for errors. I've seen before where cmdlets don't seem to acknowledge the -ErrorAction common parameter.
$ErrorActionPreference = 'SilentlyContinue'
Add-TfsPendingChange -Edit -Item $PathToFolderToCheckout -Recurse
$ErrorActionPreference = 'Continue'
After some efforts, I successfully get it for our Tfs builds! \o/
You have to end the command line with *>&1 | out-null
For exemple:
Add-TfsPendingChange -Edit -Item $PathToFolderToCheckout -Recurse *>&1 | out-null
The side effect is that all the messages that cause the errors are lost.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With