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/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs index d136a7f9e3d4..352421de7803 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAnAotApp.cs @@ -594,7 +594,7 @@ 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("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 +609,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..6c30ccf2701e 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs @@ -169,8 +169,8 @@ 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("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 +182,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();