annyka
annyka

Reputation: 121

Yaml missed comma flow between collection entries (line starting with square brackets)

I need to include the following powershell script in my .yml file:

 [byte[]] $projectFile = [System.IO.File]::ReadAllBytes($ProjectFilePath)

How to fix the error?

Upvotes: 0

Views: 785

Answers (1)

flyx
flyx

Reputation: 39708

[ is a special character in YAML and starts a flow sequence. If you want that character at the beginning of a scalar, value, quote the value:

"[byte[]] $projectFile = [System.IO.File]::ReadAllBytes($ProjectFilePath)"

Alternatively, use a literal block scalar:

key: |-
  [byte[]] $projectFile = [System.IO.File]::ReadAllBytes($ProjectFilePath)

Upvotes: 3

Related Questions