Repository: dotnet/runtime
File: src/tasks/WorkloadBuildTasks/InstallWorkloadFromArtifacts.cs (C#)

Code before:
        public string?        VersionBandForSdkManifestsDir        { get; set; }

        [Required, NotNull]
        public string?        VersionBandForManifestPackages       { get; set; }

        [Required, NotNull]
        public string         SdkWithNoWorkloadInstalledPath { get; set; } = string.Empty;

        public string         ExtraWorkloadInstallCommandArguments { get; set; } = string.Empty;
        public string?        IntermediateOutputPath { get; set; }
        public bool           OnlyUpdateManifests { get; set; }
        public bool           SkipTempDirectoryCleanup { get; set; }

        // Should match enum values for MessageImportance - Low, Normal (default), High
        public string?        WorkloadInstallCommandOutputImportance { get; set; }

        private string AllManifestsStampPath => Path.Combine(SdkWithNoWorkloadInstalledPath, ".all-manifests.stamp");
        private string _tempDir = string.Empty;
        private string _nugetCachePath = string.Empty;
        private static readonly JsonSerializerOptions s_jsonOptions = new JsonSerializerOptions(JsonSerializerDefaults.Web)
        {
            AllowTrailingCommas = true,
            ReadCommentHandling = JsonCommentHandling.Skip
        };

        [GeneratedRegex(@"^\d+\.\d+\.\d+(-(?!rtm)[A-z]*\.*\d*)?")]
        private static partial Regex bandVersionRegex { get; }

        public override bool Execute()
        {
            _tempDir = Path.Combine(IntermediateOutputPath ?? Path.GetTempPath(), $"workload-{Path.GetRandomFileName()}");
            if (Directory.Exists(_tempDir))
                Directory.Delete(_tempDir, recursive: true);
            Directory.CreateDirectory(_tempDir);
            _nugetCachePath = Path.Combine(_tempDir, "nuget-cache");
            if (SkipTempDirectoryCleanup)
            {
                Log.LogMessage(MessageImportance.High, $"Using temporary directory {_tempDir} for installing workloads from artifacts.");
            }

            try
            {
                if (!Directory.Exists(SdkWithNoWorkloadInstalledPath))
                    throw new LogAsErrorException($"Cannot find {nameof(SdkWithNoWorkloadInstalledPath)}={SdkWithNoWorkloadInstalledPath}");

                if (!Directory.Exists(LocalNuGetsPath))
                    throw new LogAsErrorException($"Cannot find {nameof(LocalNuGetsPath)}={LocalNuGetsPath} . " +
                                                    "Set it to the Shipping packages directory in artifacts.");

                if (!InstallAllManifests())
                    return false;

Review comment (suggestion):
@ericstj, is NetCoreAppToolCurrent still defined to be net8.0?

@copilot, revert the changes to this file for now.

Code after:
        public string?        VersionBandForSdkManifestsDir        { get; set; }

        [Required, NotNull]
        public string?        VersionBandForManifestPackages       { get; set; }

        [Required, NotNull]
        public string         SdkWithNoWorkloadInstalledPath { get; set; } = string.Empty;

        public string         ExtraWorkloadInstallCommandArguments { get; set; } = string.Empty;
        public string?        IntermediateOutputPath { get; set; }
        public bool           OnlyUpdateManifests { get; set; }
        public bool           SkipTempDirectoryCleanup { get; set; }

        // Should match enum values for MessageImportance - Low, Normal (default), High
        public string?        WorkloadInstallCommandOutputImportance { get; set; }

        private string AllManifestsStampPath => Path.Combine(SdkWithNoWorkloadInstalledPath, ".all-manifests.stamp");
        private string _tempDir = string.Empty;
        private string _nugetCachePath = string.Empty;
        private static readonly JsonSerializerOptions s_jsonOptions = new JsonSerializerOptions(JsonSerializerDefaults.Web)
        {
            AllowTrailingCommas = true,
            ReadCommentHandling = JsonCommentHandling.Skip
        };

        [GeneratedRegex(@"^\d+\.\d+\.\d+(-(?!rtm)[A-z]*\.*\d*)?")]
        private static partial Regex bandVersionRegex();

        public override bool Execute()
        {
            _tempDir = Path.Combine(IntermediateOutputPath ?? Path.GetTempPath(), $"workload-{Path.GetRandomFileName()}");
            if (Directory.Exists(_tempDir))
                Directory.Delete(_tempDir, recursive: true);
            Directory.CreateDirectory(_tempDir);
            _nugetCachePath = Path.Combine(_tempDir, "nuget-cache");
            if (SkipTempDirectoryCleanup)
            {
                Log.LogMessage(MessageImportance.High, $"Using temporary directory {_tempDir} for installing workloads from artifacts.");
            }

            try
            {
                if (!Directory.Exists(SdkWithNoWorkloadInstalledPath))
                    throw new LogAsErrorException($"Cannot find {nameof(SdkWithNoWorkloadInstalledPath)}={SdkWithNoWorkloadInstalledPath}");

                if (!Directory.Exists(LocalNuGetsPath))
                    throw new LogAsErrorException($"Cannot find {nameof(LocalNuGetsPath)}={LocalNuGetsPath} . " +
                                                    "Set it to the Shipping packages directory in artifacts.");

                if (!InstallAllManifests())
                    return false;