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 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 85a52b580f19..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)] @@ -646,18 +647,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/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs index 6e39fe3c3183..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. @@ -196,19 +197,19 @@ 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); 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/test/dotnet-new.Tests/CommonTemplatesTests.cs b/test/dotnet-new.Tests/CommonTemplatesTests.cs index 98c86dde4016..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) @@ -420,7 +421,7 @@ public async Task FeaturesSupport( { new DotnetBuildCommand(_log, "MyProject") .WithWorkingDirectory(workingDir) - .Execute() + .Execute("/p:CheckEolTargetFramework=false") .Should() .Pass() .And.NotHaveStdErr();