Skip to content

Commit 16bc0dc

Browse files
committed
[Infra] Use dotnet-install.ps1 to install missing sdk.
1 parent 3c97c95 commit 16bc0dc

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Build/Nuke/Build.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using System.Collections.Generic;
22
using System.IO;
33
using System.Linq;
4+
using System.Net;
5+
using System.Net.Http;
46
using System.Runtime.InteropServices;
57
using Nuke.Common;
68
using Nuke.Common.CI;
@@ -14,11 +16,12 @@
1416
using Nuke.Common.Tools.Chocolatey;
1517
using Nuke.Common.Tools.DotNet;
1618
using Nuke.Common.Tools.GitVersion;
19+
using Nuke.Common.Tools.PowerShell;
1720
using Nuke.Common.Utilities.Collections;
1821
using static Nuke.Common.IO.FileSystemTasks;
1922
using static Nuke.Common.Tools.DotNet.DotNetTasks;
2023

21-
[CheckBuildProjectConfigurations(TimeoutInMilliseconds = 20000)]
24+
[CheckBuildProjectConfigurations]
2225
[UnsetVisualStudioEnvironmentVariables]
2326
[GitHubActions(
2427
"continuous",
@@ -77,7 +80,14 @@ partial class Build : Nuke.Common.NukeBuild
7780
return;
7881
if (AzurePipelines == null && GitHubActions == null)
7982
return;
80-
ChocolateyTasks.Chocolatey(" install dotnetcore-sdk --version=3.0.103");
83+
var ps1File = ResultDirectory / "donet-install.ps1";
84+
using var client = new HttpClient();
85+
using (var s = client.GetStreamAsync(@"https://dot.net/v1/dotnet-install.ps1"))
86+
{
87+
using var fs = new FileStream(ps1File, FileMode.CreateNew);
88+
s.Result.CopyTo(fs);
89+
}
90+
PowerShellTasks.PowerShell($" {ps1File} -Channel 3.0 -Architecture x86");
8191
});
8292

8393
Target Clean => _ => _

0 commit comments

Comments
 (0)