@@ -92,68 +92,6 @@ function Exec-Process([string]$command, [string]$commandArgs) {
92
92
}
93
93
}
94
94
95
- function Write-PipelineTaskError {
96
- [CmdletBinding ()]
97
- param (
98
- [Parameter (Mandatory = $true )]
99
- [string ]$Message ,
100
- [Parameter (Mandatory = $false )]
101
- [string ]$Type = ' error' ,
102
- [string ]$ErrCode ,
103
- [string ]$SourcePath ,
104
- [string ]$LineNumber ,
105
- [string ]$ColumnNumber ,
106
- [switch ]$AsOutput )
107
-
108
- if (! $ci ) {
109
- if ($Type -eq ' error' ) {
110
- Write-Error $Message
111
- return
112
- }
113
- elseif ($Type -eq ' warning' ) {
114
- Write-Warning $Message
115
- return
116
- }
117
- }
118
-
119
- if (($Type -ne ' error' ) -and ($Type -ne ' warning' )) {
120
- Write-Host $Message
121
- return
122
- }
123
- if (-not $PSBoundParameters.ContainsKey (' Type' )) {
124
- $PSBoundParameters.Add (' Type' , ' error' )
125
- }
126
- Write-LogIssue @PSBoundParameters
127
- }
128
-
129
- function Write-PipelineSetVariable {
130
- [CmdletBinding ()]
131
- param (
132
- [Parameter (Mandatory = $true )]
133
- [string ]$Name ,
134
- [string ]$Value ,
135
- [switch ]$Secret ,
136
- [switch ]$AsOutput )
137
-
138
- if ($ci ) {
139
- Write-LoggingCommand - Area ' task' - Event ' setvariable' - Data $Value - Properties @ {
140
- ' variable' = $Name
141
- ' issecret' = $Secret
142
- } - AsOutput:$AsOutput
143
- }
144
- }
145
-
146
- function Write-PipelinePrependPath {
147
- [CmdletBinding ()]
148
- param (
149
- [Parameter (Mandatory = $true )]
150
- [string ]$Path ,
151
- [switch ]$AsOutput )
152
- if ($ci ) {
153
- Write-LoggingCommand - Area ' task' - Event ' prependpath' - Data $Path - AsOutput:$AsOutput
154
- }
155
- }
156
-
157
95
function InitializeDotNetCli ([bool ]$install ) {
158
96
if (Test-Path variable:global:_DotNetInstallDir) {
159
97
return $global :_DotNetInstallDir
@@ -196,7 +134,7 @@ function InitializeDotNetCli([bool]$install) {
196
134
if ($install ) {
197
135
InstallDotNetSdk $dotnetRoot $dotnetSdkVersion
198
136
} else {
199
- Write-PipelineTaskError " Unable to find dotnet with SDK version '$dotnetSdkVersion '"
137
+ Write-Host " Unable to find dotnet with SDK version '$dotnetSdkVersion '" - ForegroundColor Red
200
138
ExitWithExitCode 1
201
139
}
202
140
}
@@ -209,10 +147,12 @@ function InitializeDotNetCli([bool]$install) {
209
147
# It also ensures that VS msbuild will use the downloaded sdk targets.
210
148
$env: PATH = " $dotnetRoot ;$env: PATH "
211
149
212
- # Make Sure that our bootstrapped dotnet cli is avaliable in future steps of the Azure Pipelines build
213
- Write-PipelinePrependPath - Path $dotnetRoot
214
- Write-PipelineSetVariable - Name ' DOTNET_MULTILEVEL_LOOKUP' - Value ' 0'
215
- Write-PipelineSetVariable - Name ' DOTNET_SKIP_FIRST_TIME_EXPERIENCE' - Value ' 1'
150
+ if ($ci ) {
151
+ # Make Sure that our bootstrapped dotnet cli is avaliable in future steps of the Azure Pipelines build
152
+ Write-Host " ##vso[task.prependpath]$dotnetRoot "
153
+ Write-Host " ##vso[task.setvariable variable=DOTNET_MULTILEVEL_LOOKUP]0"
154
+ Write-Host " ##vso[task.setvariable variable=DOTNET_SKIP_FIRST_TIME_EXPERIENCE]1"
155
+ }
216
156
217
157
return $global :_DotNetInstallDir = $dotnetRoot
218
158
}
@@ -244,7 +184,7 @@ function InstallDotNet([string] $dotnetRoot, [string] $version, [string] $archit
244
184
245
185
& $installScript @installParameters
246
186
if ($lastExitCode -ne 0 ) {
247
- Write-PipelineTaskError - Message " Failed to install dotnet cli (exit code '$lastExitCode ')."
187
+ Write-Host " Failed to install dotnet cli (exit code '$lastExitCode ')." - ForegroundColor Red
248
188
ExitWithExitCode $lastExitCode
249
189
}
250
190
}
@@ -418,7 +358,7 @@ function InitializeBuildTool() {
418
358
419
359
if ($msbuildEngine -eq " dotnet" ) {
420
360
if (! $dotnetRoot ) {
421
- Write-PipelineTaskError " /global.json must specify 'tools.dotnet'."
361
+ Write-Host " /global.json must specify 'tools.dotnet'." - ForegroundColor Red
422
362
ExitWithExitCode 1
423
363
}
424
364
@@ -427,13 +367,13 @@ function InitializeBuildTool() {
427
367
try {
428
368
$msbuildPath = InitializeVisualStudioMSBuild - install:$restore
429
369
} catch {
430
- Write-PipelineTaskError $_
370
+ Write-Host $_ - ForegroundColor Red
431
371
ExitWithExitCode 1
432
372
}
433
373
434
374
$buildTool = @ { Path = $msbuildPath ; Command = " " ; Tool = " vs" ; Framework = " net472" }
435
375
} else {
436
- Write-PipelineTaskError " Unexpected value of -msbuildEngine: '$msbuildEngine '."
376
+ Write-Host " Unexpected value of -msbuildEngine: '$msbuildEngine '." - ForegroundColor Red
437
377
ExitWithExitCode 1
438
378
}
439
379
@@ -450,7 +390,7 @@ function GetDefaultMSBuildEngine() {
450
390
return " dotnet"
451
391
}
452
392
453
- Write-PipelineTaskError " -msbuildEngine must be specified, or /global.json must specify 'tools.dotnet' or 'tools.vs'."
393
+ Write-Host " -msbuildEngine must be specified, or /global.json must specify 'tools.dotnet' or 'tools.vs'." - ForegroundColor Red
454
394
ExitWithExitCode 1
455
395
}
456
396
@@ -501,7 +441,7 @@ function InitializeToolset() {
501
441
}
502
442
503
443
if (-not $restore ) {
504
- Write-PipelineTaskError " Toolset version $toolsetVersion has not been restored."
444
+ Write-Host " Toolset version $toolsetVersion has not been restored." - ForegroundColor Red
505
445
ExitWithExitCode 1
506
446
}
507
447
@@ -586,7 +526,7 @@ function MSBuild-Core() {
586
526
$exitCode = Exec- Process $buildTool.Path $cmdArgs
587
527
588
528
if ($exitCode -ne 0 ) {
589
- Write-PipelineTaskError " Build failed."
529
+ Write-Host " Build failed." - ForegroundColor Red
590
530
591
531
$buildLog = GetMSBuildBinaryLogCommandLineArgument $args
592
532
if ($buildLog -ne $null ) {
@@ -614,8 +554,6 @@ function GetMSBuildBinaryLogCommandLineArgument($arguments) {
614
554
return $null
615
555
}
616
556
617
- . $PSScriptRoot \LoggingCommandFunctions.ps1
618
-
619
557
$RepoRoot = Resolve-Path (Join-Path $PSScriptRoot " ..\.." )
620
558
$EngRoot = Resolve-Path (Join-Path $PSScriptRoot " .." )
621
559
$ArtifactsDir = Join-Path $RepoRoot " artifacts"
@@ -631,8 +569,11 @@ Create-Directory $ToolsetDir
631
569
Create- Directory $TempDir
632
570
Create- Directory $LogDir
633
571
634
- Write-PipelineSetVariable - Name ' Artifacts' - Value $ArtifactsDir
635
- Write-PipelineSetVariable - Name ' Artifacts.Toolset' - Value $ToolsetDir
636
- Write-PipelineSetVariable - Name ' Artifacts.Log' - Value $LogDir
637
- Write-PipelineSetVariable - Name ' TEMP' - Value $TempDir
638
- Write-PipelineSetVariable - Name ' TMP' - Value $TempDir
572
+ if ($ci ) {
573
+ Write-Host " ##vso[task.setvariable variable=Artifacts]$ArtifactsDir "
574
+ Write-Host " ##vso[task.setvariable variable=Artifacts.Toolset]$ToolsetDir "
575
+ Write-Host " ##vso[task.setvariable variable=Artifacts.Log]$LogDir "
576
+
577
+ $env: TEMP = $TempDir
578
+ $env: TMP = $TempDir
579
+ }
0 commit comments