Skip to content
Merged
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 @@ -22,8 +22,8 @@ Copyright (c) .NET Foundation. All rights reserved.

<_NoneAnalysisLevel>4.0</_NoneAnalysisLevel>
<!-- When the base TFM of the platform bumps, these must be bumped as well. Preview should always be the 'next' TFM. -->
<_LatestAnalysisLevel>7.0</_LatestAnalysisLevel>
<_PreviewAnalysisLevel>8.0</_PreviewAnalysisLevel>
<_LatestAnalysisLevel>8.0</_LatestAnalysisLevel>
<_PreviewAnalysisLevel>9.0</_PreviewAnalysisLevel>

<AnalysisLevel Condition="'$(AnalysisLevel)' == '' And
'$(TargetFrameworkIdentifier)' == '.NETCoreApp' And
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void It_builds_and_runs()
var exe = Path.Combine( //find the platform directory
new DirectoryInfo(Path.Combine(testAsset.TestRoot, "CSConsoleApp", "bin")).GetDirectories().Single().FullName,
"Debug",
ToolsetInfo.NextTargetFramework,
ToolsetInfo.CurrentTargetFramework,
"CSConsoleApp.exe");

var runCommand = new RunExeCommand(Log, exe);
Expand All @@ -60,7 +60,7 @@ public void It_builds_and_runs()
[FullMSBuildOnlyFact]
public void It_builds_and_runs_with_package_reference()
{
var targetFramework = ToolsetInfo.NextTargetFramework + "-windows";
var targetFramework = ToolsetInfo.CurrentTargetFramework + "-windows";
var testAsset = _testAssetsManager
.CopyTestAsset("NetCoreCsharpAppReferenceCppCliLib")
.WithSource()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public GivenThatWeWantToBuildAWindowsDesktopProject(ITestOutputHelper log) : bas
[InlineData("UseWPF")]
public void It_errors_when_missing_windows_target_platform(string propertyName)
{
var targetFramework = ToolsetInfo.NextTargetFramework;
var targetFramework = ToolsetInfo.CurrentTargetFramework;
TestProject testProject = new TestProject()
{
Name = "MissingTargetPlatform",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,9 @@ public void It_includes_internals_visible_to()

[RequiresMSBuildVersionTheory("17.0.0.32901")]
[InlineData(true, true, "net5.0")]
[InlineData(true, true, ToolsetInfo.NextTargetFramework)]
[InlineData(true, false, ToolsetInfo.NextTargetFramework)]
[InlineData(false, false, ToolsetInfo.NextTargetFramework)]
[InlineData(true, true, ToolsetInfo.CurrentTargetFramework)]
[InlineData(true, false, ToolsetInfo.CurrentTargetFramework)]
[InlineData(false, false, ToolsetInfo.CurrentTargetFramework)]
public void TestPreviewFeatures(bool enablePreviewFeatures, bool generateRequiresPreviewFeaturesAttribute, string targetFramework)
{
var testAsset = _testAssetsManager
Expand Down Expand Up @@ -419,7 +419,7 @@ public void TestPreviewFeatures(bool enablePreviewFeatures, bool generateRequire

if (enablePreviewFeatures && generateRequiresPreviewFeaturesAttribute)
{
if (targetFramework == ToolsetInfo.NextTargetFramework)
if (targetFramework == ToolsetInfo.CurrentTargetFramework)
{
Assert.Equal("Preview", langVersion);
Assert.True(contains);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static void Main()
};

var testAsset = _testAssetsManager
.CreateTestProject(testProject, identifier: "warningLevelConsoleApp"+tfm, targetExtension: ".csproj");
.CreateTestProject(testProject, identifier: "warningLevelConsoleApp" + tfm, targetExtension: ".csproj");

var buildCommand = new GetValuesCommand(
Log,
Expand All @@ -69,10 +69,10 @@ static void Main()
computedWarningLevel.Should().Be(parsedWarningLevel.ToString());
}

[InlineData(1, 1)]
[InlineData(null, 7)]
[InlineData(1, "1")]
[InlineData(null, ToolsetInfo.CurrentTargetFrameworkVersion)]
[RequiresMSBuildVersionTheory("16.8")]
public void It_always_accepts_user_defined_WarningLevel(int? warningLevel, int expectedWarningLevel)
public void It_always_accepts_user_defined_WarningLevel(int? warningLevel, string expectedWarningLevel)
{
var testProject = new TestProject
{
Expand Down Expand Up @@ -110,7 +110,7 @@ static void Main()
var buildResult = buildCommand.Execute();
var computedWarningLevel = buildCommand.GetValues()[0];
buildResult.StdErr.Should().Be(string.Empty);
computedWarningLevel.Should().Be(expectedWarningLevel.ToString());
computedWarningLevel.Should().Be(((int)float.Parse(expectedWarningLevel)).ToString());
}

[InlineData(targetFrameworkNet6, "6.0")]
Expand Down Expand Up @@ -143,7 +143,7 @@ static void Main()
};

var testAsset = _testAssetsManager
.CreateTestProject(testProject, identifier: "analysisLevelConsoleApp"+tfm, targetExtension: ".csproj");
.CreateTestProject(testProject, identifier: "analysisLevelConsoleApp" + tfm, targetExtension: ".csproj");

var buildCommand = new GetValuesCommand(
Log,
Expand All @@ -154,12 +154,13 @@ static void Main()
};
var buildResult = buildCommand.Execute();

buildResult.StdErr.Should().Be(string.Empty);
buildResult.StdErr.Should().Be(string.Empty);
if (analysisLevel == null)
{
buildCommand.GetValues().Should().BeEmpty();
}
else {
else
{
var computedEffectiveAnalysisLevel = buildCommand.GetValues()[0];
computedEffectiveAnalysisLevel.Should().Be(analysisLevel.ToString());
}
Expand Down Expand Up @@ -195,7 +196,7 @@ static void Main()
testProject.AdditionalProperties.Add("AnalysisLevel", "preview");

var testAsset = _testAssetsManager
.CreateTestProject(testProject, identifier: "analysisLevelPreviewConsoleApp"+currentTFM, targetExtension: ".csproj");
.CreateTestProject(testProject, identifier: "analysisLevelPreviewConsoleApp" + currentTFM, targetExtension: ".csproj");

var buildCommand = new GetValuesCommand(
Log,
Expand All @@ -206,7 +207,7 @@ static void Main()
};
var buildResult = buildCommand.Execute();

buildResult.StdErr.Should().Be(string.Empty);
buildResult.StdErr.Should().Be(string.Empty, "If this test fails when updating to a new TFM, you need to update _PreviewAnalysisLevel and _LatestAnalysisLevel in Microsoft.NET.SDK.Analyzers.Targets");
var computedEffectiveAnalysisLevel = buildCommand.GetValues()[0];
computedEffectiveAnalysisLevel.Should().Be(nextTFMVersionNumber.ToString());
}
Expand Down Expand Up @@ -242,7 +243,7 @@ static void Main()
testProject.AdditionalProperties.Add("AnalysisLevel", analysisLevel);

var testAsset = _testAssetsManager
.CreateTestProject(testProject, identifier: "analysisLevelPreviewConsoleApp"+ToolsetInfo.CurrentTargetFramework+analysisLevel, targetExtension: ".csproj");
.CreateTestProject(testProject, identifier: "analysisLevelPreviewConsoleApp" + ToolsetInfo.CurrentTargetFramework + analysisLevel, targetExtension: ".csproj");

var buildCommand = new GetValuesCommand(
Log,
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/Microsoft.NET.Build.Tests/ReferenceExeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ public void ExeProjectCanReferenceTestProject(string testTemplateName)
var testConsoleProject = new TestProject("ConsoleApp")
{
IsExe = true,
TargetFrameworks = ToolsetInfo.NextTargetFramework,
TargetFrameworks = ToolsetInfo.CurrentTargetFramework,
RuntimeIdentifier = EnvironmentInfo.GetCompatibleRid()
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ public void It_publishes_correctly_in_PublishRelease_evaluation_despite_option_f
var publishCommand = new DotnetPublishCommand(Log, helloWorldAsset.TestRoot);

publishCommand
.Execute("-f", "net7.0")
.Execute("-f", ToolsetInfo.CurrentTargetFramework)
.Should()
.Pass().And.NotHaveStdErr();
}
Expand Down
3 changes: 0 additions & 3 deletions src/Tests/Microsoft.NET.Publish.Tests/PublishTestUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ internal static class PublishTestUtils
new object[] { "net5.0" },
new object[] { "net6.0" },
new object[] { ToolsetInfo.CurrentTargetFramework },
new object[] { ToolsetInfo.NextTargetFramework }
};

// This list should contain all supported TFMs after net5.0
Expand All @@ -26,15 +25,13 @@ internal static class PublishTestUtils
new object[] { "net5.0" },
new object[] { "net6.0" },
new object[] { ToolsetInfo.CurrentTargetFramework },
new object[] { ToolsetInfo.NextTargetFramework }
};

// This list should contain all supported TFMs after net6.0
public static IEnumerable<object[]> Net6Plus { get; } = new List<object[]>
{
new object[] { "net6.0" },
new object[] { ToolsetInfo.CurrentTargetFramework },
new object[] { ToolsetInfo.NextTargetFramework }
};
#else
#error If building for a newer TFM, please update the values above
Expand Down
8 changes: 4 additions & 4 deletions src/Tests/Microsoft.NET.TestFramework/ToolsetInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ namespace Microsoft.NET.TestFramework
{
public class ToolsetInfo
{
public const string CurrentTargetFramework = "net7.0";
public const string CurrentTargetFrameworkVersion = "7.0";
public const string NextTargetFramework = "net8.0";
public const string NextTargetFrameworkVersion = "8.0";
public const string CurrentTargetFramework = "net8.0";
public const string CurrentTargetFrameworkVersion = "8.0";
public const string NextTargetFramework = "net9.0";
public const string NextTargetFrameworkVersion = "9.0";

public const string LatestWinRuntimeIdentifier = "win10";
public const string LatestLinuxRuntimeIdentifier = "ubuntu.22.04";
Expand Down