From 562d687daab221ef8666e0c9bab9127006d1eebd Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Mon, 7 Nov 2022 22:58:47 +0300 Subject: [PATCH 1/6] Use 7.0.100 SDK --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index dc6da556b3..a9318b212f 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.100-rc.2.22477.23", + "version": "7.0.100", "rollForward": "latestFeature" }, "msbuild-sdks": { From b5cf18bd4d148809918ff68cb263fa87c6d603dd Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Mon, 7 Nov 2022 23:01:29 +0300 Subject: [PATCH 2/6] Install 7.0.100 --- azure-pipelines.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 903f9e3843..ee78a79e89 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -37,7 +37,7 @@ jobs: - task: UseDotNet@2 displayName: 'Use .NET Core SDK 7.0.100-rc.2.22477.23' inputs: - version: 7.0.100-rc.2.22477.23 + version: 7.0.100 - task: CmdLine@2 displayName: 'Install Workloads' @@ -74,7 +74,7 @@ jobs: - task: UseDotNet@2 displayName: 'Use .NET Core SDK 7.0.100-rc.2.22477.23' inputs: - version: 7.0.100-rc.2.22477.23 + version: 7.0.100 - task: CmdLine@2 displayName: 'Install Workloads' @@ -145,7 +145,7 @@ jobs: - task: UseDotNet@2 displayName: 'Use .NET Core SDK 7.0.100-rc.2.22477.23' inputs: - version: 7.0.100-rc.2.22477.23 + version: 7.0.100 - task: CmdLine@2 displayName: 'Install Workloads' From 6c32c97ec5f5871507691f1439fbcb8483cdb9f2 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Mon, 7 Nov 2022 23:04:35 +0300 Subject: [PATCH 3/6] Update azure-pipelines.yml --- azure-pipelines.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ee78a79e89..a3bbc33418 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -35,7 +35,7 @@ jobs: version: 6.0.401 - task: UseDotNet@2 - displayName: 'Use .NET Core SDK 7.0.100-rc.2.22477.23' + displayName: 'Use .NET Core SDK 7.0' inputs: version: 7.0.100 @@ -72,7 +72,7 @@ jobs: version: 6.0.401 - task: UseDotNet@2 - displayName: 'Use .NET Core SDK 7.0.100-rc.2.22477.23' + displayName: 'Use .NET Core SDK 7.0.100' inputs: version: 7.0.100 @@ -143,7 +143,7 @@ jobs: version: 6.0.401 - task: UseDotNet@2 - displayName: 'Use .NET Core SDK 7.0.100-rc.2.22477.23' + displayName: 'Use .NET Core SDK 7.0.100' inputs: version: 7.0.100 From a52696bcd6efbdc74e294ab41a267a4092bd9e53 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Tue, 8 Nov 2022 13:41:08 -0500 Subject: [PATCH 4/6] Update Microsoft.Build.Framework --- nukebuild/_build.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nukebuild/_build.csproj b/nukebuild/_build.csproj index 865d935ad7..efad0d69f4 100644 --- a/nukebuild/_build.csproj +++ b/nukebuild/_build.csproj @@ -17,7 +17,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive From 9003dfde5164f5ba7ca47b87fbc6827e8c7bb554 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Tue, 8 Nov 2022 13:52:43 -0500 Subject: [PATCH 5/6] Parse target framework manually --- nukebuild/Build.cs | 19 ++++++++++++++++++- nukebuild/_build.csproj | 3 +-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/nukebuild/Build.cs b/nukebuild/Build.cs index 7425c344c3..2295c0beda 100644 --- a/nukebuild/Build.cs +++ b/nukebuild/Build.cs @@ -145,8 +145,25 @@ partial class Build : NukeBuild { Information($"Running tests from {projectName}"); var project = Solution.GetProject(projectName).NotNull("project != null"); + // Nuke and MSBuild tools have build-in helpers to get target frameworks from the project. + // Unfortunately, it gets broken with every second SDK update, so we had to do it manually. + var fileXml = XDocument.Parse(File.ReadAllText(project.Path)); + var targetFrameworks = fileXml.Descendants("TargetFrameworks") + .FirstOrDefault()?.Value.Split(';').Select(f => f.Trim()); + if (targetFrameworks is null) + { + var targetFramework = fileXml.Descendants("TargetFramework").FirstOrDefault()?.Value; + if (targetFramework is not null) + { + targetFrameworks = new[] { targetFramework }; + } + } + if (targetFrameworks is null) + { + throw new InvalidOperationException("No target frameworks were found in the test project"); + } - foreach (var fw in project.GetTargetFrameworks()) + foreach (var fw in targetFrameworks) { if (fw.StartsWith("net4") && RuntimeInformation.IsOSPlatform(OSPlatform.Linux) diff --git a/nukebuild/_build.csproj b/nukebuild/_build.csproj index efad0d69f4..591c72445b 100644 --- a/nukebuild/_build.csproj +++ b/nukebuild/_build.csproj @@ -16,8 +16,7 @@ - - + all runtime; build; native; contentfiles; analyzers; buildtransitive From 6b080eabe02588d3cd28e7c7b389ba7c40b70197 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Tue, 8 Nov 2022 14:28:16 -0500 Subject: [PATCH 6/6] Restore Microsoft.Build.Framework dependency --- nukebuild/_build.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/nukebuild/_build.csproj b/nukebuild/_build.csproj index 591c72445b..92d9732e91 100644 --- a/nukebuild/_build.csproj +++ b/nukebuild/_build.csproj @@ -17,6 +17,7 @@ + all runtime; build; native; contentfiles; analyzers; buildtransitive