How to show Visual Studio Online build task Write-Verbose statements?
To get verbose and debug statements to show up in the log you simply need to add the System.Debug variable to the variables on your definition.
Here's what worked for me:
- Use
Write-Verbose "Text" -Verbose
inside your script - Assign build variable
system.debug
totrue
(Just moving comments to an answer)
Since the script has params, but does not have CmdletBinding
, nor a [Parameter(...)]
then -Verbose
is not honored.
Solution: Add [CmdletBinding()]
before the params
or add a [Parameter(Mandatory=$true)]
or something similar to one or more of the individual parameter variables.
From about_parameters:
All attributes are optional. However, if you omit the CmdletBinding attribute, then to be recognized as an advanced function, the function must include the Parameter attribute.
about_Functions_CmdletBindingAttribute has more information on the abilities bestowed upon cmdlets.