private void InstallDotNetRuntime()
        {
            HttpTasks.HttpDownloadFile(ScriptUrl, ScriptFile);

            var version          = GetDotNetRuntimeVersion();
            var installLocation  = Constants.GlobalNukeDirectory / "dotnet-runtime" / (version ?? "current");
            var dotnetExecutable = installLocation / (EnvironmentInfo.IsWin ? "dotnet.exe" : "dotnet");

            if (version == null || !File.Exists(dotnetExecutable))
            {
                if (EnvironmentInfo.IsLinux)
                {
                    ProcessTasks.StartShell($"chmod +x {ScriptFile.ToString().DoubleQuoteIfNeeded()}", logOutput: false)
                    .AssertZeroExitCode();
                }

                ProcessTasks.StartShell(
                    EnvironmentInfo.IsWin
                            ? $"powershell {ScriptFile.ToString().DoubleQuoteIfNeeded()} -InstallDir {installLocation} -NoPath -Runtime dotnet "
                    + (version != null ? $"-Version {version}" : "-Channel Current")
                            : $"{ScriptFile.ToString().DoubleQuoteIfNeeded()} --install-dir {installLocation} --no-path --runtime dotnet "
                    + (version != null ? $"--version {version}" : "--channel Current"),
                    logOutput: false)
                .AssertZeroExitCode();
            }

            EnvironmentInfo.SetVariable("DOTNET_EXE", dotnetExecutable);
            EnvironmentInfo.SetVariable("DOTNET_SYSTEM_GLOBALIZATION_INVARIANT", value: true);
        }