@@ -33,6 +33,7 @@ target_arch='x64'
33
33
configuration=' '
34
34
runtime_source_feed=' '
35
35
runtime_source_feed_key=' '
36
+ init_nuget=false
36
37
37
38
if [ " $( uname) " = " Darwin" ]; then
38
39
target_os_name=' osx'
@@ -82,6 +83,8 @@ Options:
82
83
--runtime-source-feed Additional feed that can be used when downloading .NET runtimes and SDKs
83
84
--runtime-source-feed-key Key for feed that can be used when downloading .NET runtimes and SDKs
84
85
86
+ --init-nuget Run nuget --version.
87
+
85
88
Description:
86
89
This build script installs required tools and runs an MSBuild command on this repository
87
90
This script can be used to invoke various targets, such as targets to produce packages
@@ -208,6 +211,9 @@ while [[ $# -gt 0 ]]; do
208
211
-ci)
209
212
ci=true
210
213
;;
214
+ -init-nuget)
215
+ init_nuget=true
216
+ ;;
211
217
-binarylog|-bl)
212
218
binary_log=true
213
219
;;
@@ -359,6 +365,30 @@ export MSBUILDDEBUGPATH="$log_dir"
359
365
_tmp_restore=$restore
360
366
restore=true
361
367
368
+ if [[ " $init_nuget " == true ]]; then
369
+ InitializeBuildTool
370
+
371
+ function RunBuildTool {
372
+ " $_InitializeBuildTool " " $@ " || {
373
+ local exit_code=$?
374
+ # We should not Write-PipelineTaskError here because that message shows up in the build summary
375
+ # The build already logged an error, that's the reason it failed. Producing an error here only adds noise.
376
+ echo " Build failed with exit code $exit_code . Check errors above."
377
+ if [[ " $ci " == " true" ]]; then
378
+ Write-PipelineSetResult -result " Failed" -message " nuget execution failed."
379
+ # Exiting with an exit code causes the azure pipelines task to log yet another "noise" error
380
+ # The above Write-PipelineSetResult will cause the task to be marked as failure without adding yet another error
381
+ ExitWithExitCode 0
382
+ else
383
+ ExitWithExitCode $exit_code
384
+ fi
385
+ }
386
+ }
387
+
388
+ echo ' Running dotnet nuget --version (issue: https://github.com/NuGet/Home/issues/12159#issuecomment-1278360511)'
389
+ RunBuildTool " nuget" " --version"
390
+ fi
391
+
362
392
InitializeToolset
363
393
364
394
restore=$_tmp_restore =
0 commit comments