Skip to content

Commit 44b2c51

Browse files
committed
[Infra] Try to use chocolatey to install net sdk.
1 parent 188694c commit 44b2c51

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Build/Nuke/Build.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using Nuke.Common.IO;
1111
using Nuke.Common.ProjectModel;
1212
using Nuke.Common.Tooling;
13+
using Nuke.Common.Tools.Chocolatey;
1314
using Nuke.Common.Tools.DotNet;
1415
using Nuke.Common.Tools.GitVersion;
1516
using Nuke.Common.Utilities.Collections;
@@ -59,15 +60,24 @@ partial class Build : Nuke.Common.NukeBuild
5960
[GitVersion(Framework = "net5.0")] readonly GitVersion GitVersion;
6061

6162
[CI] readonly AzurePipelines AzurePipelines;
62-
63-
63+
[CI] readonly GitHubActions GitHubActions;
64+
6465
AbsolutePath SourceDirectory => RootDirectory / "src";
6566
AbsolutePath ResultDirectory => RootDirectory / ".result";
6667
AbsolutePath PackagesDirectory => ResultDirectory / "packages";
6768
AbsolutePath TestResultDirectory => ResultDirectory / "test-results";
6869
IEnumerable<Project> TestProjects => Solution.GetProjects("*.Tests");
6970
IEnumerable<Project> AllProjects => Solution.AllProjects.Where(x=> SourceDirectory.Contains(x.Path));
7071

72+
Target SdkInstallation => _ => _
73+
.Before(Clean)
74+
.Executes(() =>
75+
{
76+
if (AzurePipelines == null && GitHubActions == null)
77+
return;
78+
ChocolateyTasks.Chocolatey(" install dotnetcore-sdk --version=3.0.103");
79+
});
80+
7181
Target Clean => _ => _
7282
.Before(Restore)
7383
.Executes(() =>
@@ -76,6 +86,7 @@ partial class Build : Nuke.Common.NukeBuild
7686
});
7787

7888
Target Restore => _ => _
89+
.DependsOn(SdkInstallation)
7990
.Executes(() =>
8091
{
8192
DotNetRestore(s => s

0 commit comments

Comments
 (0)