Skip to content

Add .NET 6.0 to EOL frameworks list #49823

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: release/8.0.1xx
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ Copyright (c) .NET Foundation. All rights reserved.
receive servicing updates and security fixes.
-->
<ItemGroup>
<_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" />
</ItemGroup>
<PropertyGroup>
<_MinimumNonEolSupportedNetCoreTargetFramework>net6.0</_MinimumNonEolSupportedNetCoreTargetFramework>
<_MinimumNonEolSupportedNetCoreTargetFramework>net8.0</_MinimumNonEolSupportedNetCoreTargetFramework>
</PropertyGroup>

<Target Name="_CheckForEolTargetFrameworks" AfterTargets="_CheckForUnsupportedNETCoreVersion"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public GivenThatWeWantToTargetEolFrameworks(ITestOutputHelper log) : base(log)
[InlineData("netcoreapp3.0")]
[InlineData("netcoreapp3.1")]
[InlineData("net5.0")]
[InlineData("net6.0")]
[InlineData("net7.0")]
public void It_warns_that_framework_is_out_of_support(string targetFrameworks)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ 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("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.
Expand All @@ -650,18 +650,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($"<EnableSingleFileAnalyzer Condition=\"$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))\">true</EnableSingleFileAnalyzer>");
.And.HaveStdOutContaining($"<EnableSingleFileAnalyzer Condition=\"$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))\">true</EnableSingleFileAnalyzer>");
} else {
resultAssertion.And.NotHaveStdOutContaining($"warning");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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($"<IsAotCompatible Condition=\"$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))\">true</IsAotCompatible>");
.And.HaveStdOutContaining($"<IsAotCompatible Condition=\"$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))\">true</IsAotCompatible>");
} else {
resultAssertion.And.NotHaveStdOutContaining($"warning");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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($"<IsTrimmable Condition=\"$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))\">true</IsTrimmable>");
.And.HaveStdOutContaining($"<IsTrimmable Condition=\"$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))\">true</IsTrimmable>");
} else {
resultAssertion.And.NotHaveStdOutContaining($"warning");
}
Expand Down
3 changes: 2 additions & 1 deletion src/Tests/dotnet-new.Tests/CommonTemplatesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ public async void FeaturesSupport(
string finalProjectName = Path.Combine(projectDir, $"{projName}.{extension}");

Dictionary<string, string> environmentUnderTest = new() { ["DOTNET_NOLOGO"] = false.ToString() };
environmentUnderTest["CheckEolTargetFramework"] = false.ToString();
TestContext.Current.AddTestEnvironmentVariables(environmentUnderTest);

TemplateVerifierOptions options = new TemplateVerifierOptions(templateName: name)
Expand Down Expand Up @@ -419,7 +420,7 @@ public async void FeaturesSupport(
{
new DotnetBuildCommand(_log, "MyProject")
.WithWorkingDirectory(workingDir)
.Execute()
.Execute("/p:CheckEolTargetFramework=false")
.Should()
.Pass()
.And.NotHaveStdErr();
Expand Down
Loading