From 214a132b19cddad105c9ccc7df521757a7ec7054 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 1/3] 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, 1 Jul 2025 15:29:32 -0500
Subject: [PATCH 2/3] Add .NET 6.0 to End-of-Life frameworks list to generate
NETSDK1138 warnings (#49533)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com>
Co-authored-by: Marc Paine
---
.../GivenThatWeWantToPublishASingleFileApp.cs | 10 ++++++----
.../GivenThatWeWantToPublishAnAotApp.cs | 8 +++++---
.../GivenThatWeWantToRunILLink.cs | 10 ++++++----
src/Tests/dotnet-new.Tests/CommonTemplatesTests.cs | 3 ++-
4 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs
index 21a1c24b5ed2..de676f98453c 100644
--- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs
+++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs
@@ -637,7 +637,8 @@ public void ILLink_analyzer_warnings_are_produced_using_EnableSingleFileAnalyzer
[InlineData("netstandard2.0", true)]
[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.
@@ -650,18 +651,19 @@ 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);
-
+
var buildCommand = new BuildCommand(testAsset);
- var resultAssertion = buildCommand.Execute("/bl:my.binlog")
+ 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/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs
index d136a7f9e3d4..325d8e404a60 100644
--- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs
+++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs
@@ -594,7 +594,8 @@ public void IsAotCompatible_implies_enable_analyzers(string targetFramework)
[InlineData("netstandard2.0", true)]
[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", false)]
[InlineData("alias-n7;alias-n8", false)] // If all TFMs are supported, there's no warning even though the project uses aliases.
@@ -609,18 +610,19 @@ 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);
var buildCommand = new BuildCommand(testAsset);
- var resultAssertion = buildCommand.Execute()
+ var resultAssertion = buildCommand.Execute("/p:CheckEolTargetFramework=false")
.Should().Pass();
if (shouldWarn) {
resultAssertion
// 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/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs
index bb6bb0e95706..64ec714ff61a 100644
--- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs
+++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs
@@ -169,8 +169,9 @@ public void PublishTrimmed_fails_for_unsupported_target_framework(string targetF
[InlineData("netstandard2.0", true)]
[InlineData("netstandard2.1", true)]
[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.
@@ -182,18 +183,19 @@ public void IsTrimmable_warns_when_expected_for_not_correctly_multitargeted_libr
var testProject = CreateTestProjectForILLinkTesting(targetFrameworks, projectName);
testProject.AdditionalProperties["IsTrimmable"] = "true";
+ testProject.AdditionalProperties["CheckEolTargetFramework"] = "false"; // Silence warning about targeting EOL TFMs
var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFrameworks)
.WithProjectChanges(AddTargetFrameworkAliases);
var buildCommand = new BuildCommand(testAsset);
- var resultAssertion = buildCommand.Execute()
+ var resultAssertion = buildCommand.Execute("/p:CheckEolTargetFramework=false")
.Should().Pass();
if (shouldWarn) {
resultAssertion
// 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");
}
diff --git a/src/Tests/dotnet-new.Tests/CommonTemplatesTests.cs b/src/Tests/dotnet-new.Tests/CommonTemplatesTests.cs
index aaa2da896b15..6e9dfb27711f 100644
--- a/src/Tests/dotnet-new.Tests/CommonTemplatesTests.cs
+++ b/src/Tests/dotnet-new.Tests/CommonTemplatesTests.cs
@@ -385,6 +385,7 @@ public async void 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)
@@ -419,7 +420,7 @@ public async void FeaturesSupport(
{
new DotnetBuildCommand(_log, "MyProject")
.WithWorkingDirectory(workingDir)
- .Execute()
+ .Execute("/p:CheckEolTargetFramework=false")
.Should()
.Pass()
.And.NotHaveStdErr();
From c3628f38b09f3656839e7bfa54941326e9413594 Mon Sep 17 00:00:00 2001
From: Marc Paine
Date: Fri, 18 Jul 2025 13:51:15 -0700
Subject: [PATCH 3/3] Remove the net9.0 tests that were added in the
cherry-pick
---
.../GivenThatWeWantToPublishASingleFileApp.cs | 1 -
.../GivenThatWeWantToPublishAnAotApp.cs | 1 -
.../Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs | 1 -
3 files changed, 3 deletions(-)
diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs
index de676f98453c..6d9779120140 100644
--- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs
+++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASingleFileApp.cs
@@ -638,7 +638,6 @@ public void ILLink_analyzer_warnings_are_produced_using_EnableSingleFileAnalyzer
[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", 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.
diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs
index 325d8e404a60..352421de7803 100644
--- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs
+++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs
@@ -595,7 +595,6 @@ public void IsAotCompatible_implies_enable_analyzers(string targetFramework)
[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", 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", false)]
[InlineData("alias-n7;alias-n8", false)] // If all TFMs are supported, there's no warning even though the project uses aliases.
diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs
index 64ec714ff61a..6c30ccf2701e 100644
--- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs
+++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs
@@ -171,7 +171,6 @@ public void PublishTrimmed_fails_for_unsupported_target_framework(string targetF
[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", 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.