From 6d3c989a5b574137c3512f626219491ea4ddc369 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 23 Jun 2025 20:54:10 +0000 Subject: [PATCH 1/6] Initial plan From f6af26525f71bc58c7eb8f48a34a12aa584e1457 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 23 Jun 2025 21:04:24 +0000 Subject: [PATCH 2/6] Add .NET 6.0 to EOL frameworks list Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com> --- .../targets/Microsoft.NET.EolTargetFrameworks.targets | 4 ++-- .../GivenThatWeWantToTargetEolFrameworks.cs | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.EolTargetFrameworks.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.EolTargetFrameworks.targets index 8608d9f77a33..6f03a1ca4ae3 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.EolTargetFrameworks.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.EolTargetFrameworks.targets @@ -21,10 +21,10 @@ Copyright (c) .NET Foundation. All rights reserved. receive servicing updates and security fixes. --> - <_EolNetCoreTargetFrameworkVersions Include="1.0;1.1;2.0;2.1;2.2;3.0;3.1;5.0;7.0" /> + <_EolNetCoreTargetFrameworkVersions Include="1.0;1.1;2.0;2.1;2.2;3.0;3.1;5.0;6.0;7.0" /> - <_MinimumNonEolSupportedNetCoreTargetFramework>net6.0 + <_MinimumNonEolSupportedNetCoreTargetFramework>net8.0 Date: Tue, 24 Jun 2025 00:01:32 +0000 Subject: [PATCH 3/6] Fix failing tests by suppressing .NET 6.0 EOL warnings Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com> --- .../GivenThatWeWantToPublishASingleFileApp.cs | 1 + .../GivenThatWeWantToPublishAnAotApp.cs | 1 + test/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs | 2 +- test/dotnet-new.Tests/CommonTemplatesTests.cs | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs index bcb21aeb7fec..9ec83219f694 100644 --- a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs +++ b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs @@ -744,6 +744,7 @@ public void EnableSingleFile_warns_when_expected_for_not_correctly_multitargeted TargetFrameworks = targetFrameworks }; testProject.AdditionalProperties["EnableSingleFileAnalyzer"] = "true"; + testProject.AdditionalProperties["CheckEolTargetFramework"] = "false"; // Silence warning about targeting EOL TFMs var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFrameworks) .WithProjectChanges(AddTargetFrameworkAliases); diff --git a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs index 85a52b580f19..64379c39e4d4 100644 --- a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs +++ b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs @@ -646,6 +646,7 @@ public void IsAotCompatible_warns_when_expected_for_not_correctly_multitarget_li TargetFrameworks = targetFrameworks }; testProject.AdditionalProperties["IsAotCompatible"] = "true"; + testProject.AdditionalProperties["CheckEolTargetFramework"] = "false"; // Silence warning about targeting EOL TFMs var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFrameworks) .WithProjectChanges(AddTargetFrameworkAliases); diff --git a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs index 6e39fe3c3183..e145919575a2 100644 --- a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs +++ b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs @@ -196,7 +196,7 @@ public void IsTrimmable_warns_when_expected_for_not_correctly_multitargeted_libr var testProject = CreateTestProjectForILLinkTesting(targetFrameworks, projectName); testProject.AdditionalProperties["IsTrimmable"] = "true"; - testProject.AdditionalProperties["NoWarn"] = "NETSDK1138"; // Silence warning about targeting EOL TFMs + testProject.AdditionalProperties["CheckEolTargetFramework"] = "false"; // Silence warning about targeting EOL TFMs var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFrameworks) .WithProjectChanges(AddTargetFrameworkAliases); diff --git a/test/dotnet-new.Tests/CommonTemplatesTests.cs b/test/dotnet-new.Tests/CommonTemplatesTests.cs index 98c86dde4016..008c18b96799 100644 --- a/test/dotnet-new.Tests/CommonTemplatesTests.cs +++ b/test/dotnet-new.Tests/CommonTemplatesTests.cs @@ -420,7 +420,7 @@ public async Task FeaturesSupport( { new DotnetBuildCommand(_log, "MyProject") .WithWorkingDirectory(workingDir) - .Execute() + .Execute("/p:CheckEolTargetFramework=false") .Should() .Pass() .And.NotHaveStdErr(); From b16ca58b776c69ff112f0603bf1d2b30c65ec3eb Mon Sep 17 00:00:00 2001 From: Marc Paine Date: Tue, 24 Jun 2025 16:47:43 -0700 Subject: [PATCH 4/6] Disable the EOL check for multiple tests --- .../GivenThatWeWantToPublishASingleFileApp.cs | 3 ++- .../GivenThatWeWantToPublishAnAotApp.cs | 1 + test/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs | 2 ++ test/dotnet-new.Tests/CommonTemplatesTests.cs | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs index 9ec83219f694..7172150048ec 100644 --- a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs +++ b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs @@ -747,7 +747,8 @@ public void EnableSingleFile_warns_when_expected_for_not_correctly_multitargeted testProject.AdditionalProperties["CheckEolTargetFramework"] = "false"; // Silence warning about targeting EOL TFMs var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFrameworks) .WithProjectChanges(AddTargetFrameworkAliases); - + testAsset.AdditionalProperties["CheckEolTargetFramework"] = "false"; // Silence warning about targeting EOL TFMs + var buildCommand = new BuildCommand(testAsset); var resultAssertion = buildCommand.Execute("/bl:my.binlog") .Should().Pass(); diff --git a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs index 64379c39e4d4..e4d40b25c0b8 100644 --- a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs +++ b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs @@ -649,6 +649,7 @@ public void IsAotCompatible_warns_when_expected_for_not_correctly_multitarget_li testProject.AdditionalProperties["CheckEolTargetFramework"] = "false"; // Silence warning about targeting EOL TFMs var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFrameworks) .WithProjectChanges(AddTargetFrameworkAliases); + testAsset.AdditionalProperties["CheckEolTargetFramework"] = "false"; // Silence warning about targeting EOL TFMs var buildCommand = new BuildCommand(testAsset); var resultAssertion = buildCommand.Execute() diff --git a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs index e145919575a2..a46a8a5c08ec 100644 --- a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs +++ b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs @@ -200,6 +200,8 @@ public void IsTrimmable_warns_when_expected_for_not_correctly_multitargeted_libr var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFrameworks) .WithProjectChanges(AddTargetFrameworkAliases); + testAsset.AdditionalProperties["CheckEolTargetFramework"] = "false"; // Silence warning about targeting EOL TFMs + var buildCommand = new BuildCommand(testAsset); var resultAssertion = buildCommand.Execute() .Should().Pass(); diff --git a/test/dotnet-new.Tests/CommonTemplatesTests.cs b/test/dotnet-new.Tests/CommonTemplatesTests.cs index 008c18b96799..41163757ff8d 100644 --- a/test/dotnet-new.Tests/CommonTemplatesTests.cs +++ b/test/dotnet-new.Tests/CommonTemplatesTests.cs @@ -386,6 +386,7 @@ public async Task FeaturesSupport( string finalProjectName = Path.Combine(projectDir, $"{projName}.{extension}"); Dictionary environmentUnderTest = new() { ["DOTNET_NOLOGO"] = false.ToString() }; + environmentUnderTest["CheckEolTargetFramework"] = false.ToString(); TestContext.Current.AddTestEnvironmentVariables(environmentUnderTest); TemplateVerifierOptions options = new TemplateVerifierOptions(templateName: name) From 4405f433d95ddeba8d503ee8176d0bb8d861e9a2 Mon Sep 17 00:00:00 2001 From: Marc Paine Date: Fri, 27 Jun 2025 11:46:05 -0700 Subject: [PATCH 5/6] Fix how we set the EOL property for the build --- .../GivenThatWeWantToPublishASingleFileApp.cs | 3 +-- .../GivenThatWeWantToPublishAnAotApp.cs | 3 +-- .../Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs | 4 +--- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs index 7172150048ec..a180c50c5b9f 100644 --- a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs +++ b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs @@ -747,10 +747,9 @@ public void EnableSingleFile_warns_when_expected_for_not_correctly_multitargeted testProject.AdditionalProperties["CheckEolTargetFramework"] = "false"; // Silence warning about targeting EOL TFMs var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFrameworks) .WithProjectChanges(AddTargetFrameworkAliases); - testAsset.AdditionalProperties["CheckEolTargetFramework"] = "false"; // Silence warning about targeting EOL TFMs var buildCommand = new BuildCommand(testAsset); - var resultAssertion = buildCommand.Execute("/bl:my.binlog") + var resultAssertion = buildCommand.Execute("/bl:my.binlog /p:CheckEolTargetFramework=false") .Should().Pass(); if (shouldWarn) { // Note: can't check for Strings.EnableSingleFileAnalyzerUnsupported because each line of diff --git a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs index e4d40b25c0b8..90aab45f8e59 100644 --- a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs +++ b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs @@ -649,10 +649,9 @@ public void IsAotCompatible_warns_when_expected_for_not_correctly_multitarget_li testProject.AdditionalProperties["CheckEolTargetFramework"] = "false"; // Silence warning about targeting EOL TFMs var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFrameworks) .WithProjectChanges(AddTargetFrameworkAliases); - testAsset.AdditionalProperties["CheckEolTargetFramework"] = "false"; // Silence warning about targeting EOL TFMs var buildCommand = new BuildCommand(testAsset); - var resultAssertion = buildCommand.Execute() + var resultAssertion = buildCommand.Execute("/p:CheckEolTargetFramework=false") .Should().Pass(); if (shouldWarn) { resultAssertion diff --git a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs index a46a8a5c08ec..b437aac683f8 100644 --- a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs +++ b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs @@ -200,10 +200,8 @@ public void IsTrimmable_warns_when_expected_for_not_correctly_multitargeted_libr var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFrameworks) .WithProjectChanges(AddTargetFrameworkAliases); - testAsset.AdditionalProperties["CheckEolTargetFramework"] = "false"; // Silence warning about targeting EOL TFMs - var buildCommand = new BuildCommand(testAsset); - var resultAssertion = buildCommand.Execute() + var resultAssertion = buildCommand.Execute("/p:CheckEolTargetFramework=false") .Should().Pass(); if (shouldWarn) { resultAssertion From 31f0243acaad4fab0986271b3542f92f656471d8 Mon Sep 17 00:00:00 2001 From: Marc Paine Date: Fri, 27 Jun 2025 15:49:48 -0700 Subject: [PATCH 6/6] Fix the publish tests to expect net8 as the minimum and slightly change the tests run --- .../GivenThatWeWantToPublishASingleFileApp.cs | 7 ++++--- .../GivenThatWeWantToPublishAnAotApp.cs | 5 +++-- .../GivenThatWeWantToRunILLink.cs | 7 ++++--- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs index a180c50c5b9f..3a83cf1a441d 100644 --- a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs +++ b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs @@ -731,7 +731,8 @@ public void PublishSingleFile_fails_for_unsupported_target_framework(string targ [InlineData("net6.0", false)] [InlineData("netstandard2.0;net5.0", true)] // None of these TFMs are supported for single-file [InlineData("netstandard2.0;net6.0", false)] // Net6.0 is the min TFM supported for single-file and targeting. - [InlineData("netstandard2.0;net8.0", true)] // Net8.0 is supported for single-file, but leaves a "gap" for the supported net6./net7.0 TFMs. + [InlineData("netstandard2.0;net8.0", false)] // Net8.0 is supported for single-file + [InlineData("netstandard2.0;net9.0", true)] // Net9.0 is supported for single-file, but leaves a "gap" for the supported net6./net7.0 TFMs. [InlineData("alias-ns2", true)] [InlineData("alias-n6", false)] [InlineData("alias-n6;alias-n8", false)] // If all TFMs are supported, there's no warning even though the project uses aliases. @@ -749,14 +750,14 @@ public void EnableSingleFile_warns_when_expected_for_not_correctly_multitargeted .WithProjectChanges(AddTargetFrameworkAliases); var buildCommand = new BuildCommand(testAsset); - var resultAssertion = buildCommand.Execute("/bl:my.binlog /p:CheckEolTargetFramework=false") + var resultAssertion = buildCommand.Execute("/p:CheckEolTargetFramework=false") .Should().Pass(); if (shouldWarn) { // Note: can't check for Strings.EnableSingleFileAnalyzerUnsupported because each line of // the message gets prefixed with a file path by MSBuild. resultAssertion .And.HaveStdOutContaining($"warning NETSDK1211") - .And.HaveStdOutContaining($"true"); + .And.HaveStdOutContaining($"true"); } else { resultAssertion.And.NotHaveStdOutContaining($"warning"); } diff --git a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs index 90aab45f8e59..713a2bab116f 100644 --- a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs +++ b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs @@ -630,7 +630,8 @@ public void PublishAot_fails_for_unsupported_target_framework(string targetFrame [InlineData("net7.0", false)] [InlineData("netstandard2.0;net5.0", true)] // None of these TFMs are supported for AOT [InlineData("netstandard2.0;net7.0", false)] // Net7.0 is the min TFM supported for AOT and targeting. - [InlineData("netstandard2.0;net8.0", true)] // Net8.0 is supported for AOT, but leaves a "gap" for the supported net7.0 TFMs. + [InlineData("netstandard2.0;net8.0", false)] // net8.0 is supported for AOT and targeting. + [InlineData("netstandard2.0;net9.0", true)] // Net9.0 is supported for AOT, but leaves a "gap" for the supported net8.0 TFMs. [InlineData("alias-ns2", true)] [InlineData("alias-n6", true)] [InlineData("alias-n7", false)] @@ -658,7 +659,7 @@ public void IsAotCompatible_warns_when_expected_for_not_correctly_multitarget_li // Note: can't check for Strings.IsAotCompatibleUnsupported because each line of // the message gets prefixed with a file path by MSBuild. .And.HaveStdOutContaining($"warning NETSDK1210") - .And.HaveStdOutContaining($"true"); + .And.HaveStdOutContaining($"true"); } else { resultAssertion.And.NotHaveStdOutContaining($"warning"); } diff --git a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs index b437aac683f8..08b4407d3e3c 100644 --- a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs +++ b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs @@ -183,8 +183,9 @@ public void PublishTrimmed_fails_for_unsupported_target_framework(string targetF [InlineData("net5.0", true)] [InlineData("net6.0", false)] [InlineData("netstandard2.0;net5.0", true)] // None of these TFMs are supported for trimming - [InlineData("netstandard2.0;net6.0", false)] // Net6.0 is the min TFM supported for trimming and targeting. - [InlineData("netstandard2.0;net8.0", true)] // Net8.0 is supported for trimming, but leaves a "gap" for the supported net6.0/net7.0 TFMs. + [InlineData("netstandard2.0;net6.0", false)] // net6.0 is the min TFM supported for trimming and targeting. + [InlineData("netstandard2.0;net8.0", false)] // Net8.0 is supported for trimming and targeting. + [InlineData("netstandard2.0;net9.0", true)] // Net8.0 is supported for trimming, but leaves a "gap" for the supported net6.0/net7.0 TFMs. [InlineData("alias-ns2", true)] [InlineData("alias-n6", false)] [InlineData("alias-n6;alias-n8", false)] // If all TFMs are supported, there's no warning even though the project uses aliases. @@ -208,7 +209,7 @@ public void IsTrimmable_warns_when_expected_for_not_correctly_multitargeted_libr // Note: can't check for Strings.IsTrimmableUnsupported because each line of // the message gets prefixed with a file path by MSBuild. .And.HaveStdOutContaining($"warning NETSDK1212") - .And.HaveStdOutContaining($"true"); + .And.HaveStdOutContaining($"true"); } else { resultAssertion.And.NotHaveStdOutContaining($"warning"); }