File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,13 @@ Trace-VstsEnteringInvocation $MyInvocation
1616try {
1717 Import-VstsLocStrings " $PSScriptRoot \task.json"
1818
19+ # Check Powershell Version
20+ if ($PSVersionTable.PSCompatibleVersions -notcontains ' 4.0' )
21+ {
22+ Write-VstsTaskError " This task requires Powershell 4.0 or later"
23+ exit ;
24+ }
25+
1926 $inputSearchPattern = (Get-VstsInput - Name InputSearchPattern - Require)
2027 $useUTF8 = Get-VstsInput - Name UseUTF8 - AsBool - Require
2128 $useRaw = Get-VstsInput - Name UseRAW - AsBool - Require
4754 Write-Host " Replacing $findRegex with $replaceRegex ($ext )"
4855
4956 foreach ($path in $inputPaths ) {
50- $setContentParams = @ { Path = $path ; NoNewLine = $true }
57+ $setContentParams = @ { Path = $path ; }
58+
59+ # NoNewline is only available in Powershell >= 5.0
60+ if ($PSVersionTable.PSCompatibleVersions -contains ' 5.0' )
61+ {
62+ $setContentParams.Add (" NoNewline" , $true );
63+ }
64+
5165 $getContentParams = @ { Path = $path }
5266
5367 Write-Host " ...in file $path "
You can’t perform that action at this time.
0 commit comments