I'm trying to run a script I didn't write and I'm getting this issue:
Unexpected token '?' in expression or statement.
The line of code causing this is:
$configuration = $Env:ASPNETCORE_ENVIRONMENT -eq "CI" ? "Release" : "Debug"
From what I found, this is a perfectly ok way to write a one-line or in-line if-then-else statement.
Any ideas?
As per this question: Ternary operator in PowerShell
The ternary operator was introduced to Powershell in version 7.
To check your version of Powershell, run this command:
$PSVersionTable["PSVersion"]