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 @@ -66,10 +66,16 @@ public void It_publishes_portable_apps_to_the_publish_folder_and_the_app_should_
}

[Theory]
[InlineData("netcoreapp1.1")]
[InlineData("netcoreapp2.0")]
[InlineData("netcoreapp3.0")]
public void It_publishes_self_contained_apps_to_the_publish_folder_and_the_app_should_run(string targetFramework)
{
if (!EnvironmentInfo.SupportsTargetFramework(targetFramework))
{
return;
}

var rid = EnvironmentInfo.GetCompatibleRid(targetFramework);

var helloWorldAsset = _testAssetsManager
Expand Down
37 changes: 30 additions & 7 deletions src/Tests/Microsoft.NET.TestFramework/EnvironmentInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public static bool SupportsTargetFramework(string targetFramework)
string ubuntuVersionString = restOfRid.Split('-')[0];
if (float.TryParse(ubuntuVersionString, out float ubuntuVersion))
{
if (ubuntuVersion > 16.04)
if (ubuntuVersion > 16.04f)
{
if (nugetFramework.Version < new Version(2, 0, 0, 0))
{
Expand All @@ -144,27 +144,29 @@ public static bool SupportsTargetFramework(string targetFramework)
{
string restOfRid = currentRid.Substring(ridOS.Length + 1);
string osxVersionString = restOfRid.Split('-')[0];
// From a string such as "10.14", get the second part, e.g. "14"
string osxVersionString2 = osxVersionString.Split('.')[1];
if (int.TryParse(osxVersionString2, out int osxVersion))
if (float.TryParse(osxVersionString, out float osxVersion))
{
// .NET Core 1.1 - 10.11, 10.12
// .NET Core 2.0 - 10.12+
if (osxVersion <= 11)
// .NET Core 2.1 - 10.12-10.15
// .NET 5 <= 11.0
// .NET 6 <= 12
// .NET 7 <= 13
if (osxVersion <= 10.11f)
{
if (nugetFramework.Version >= new Version(2, 0, 0, 0))
{
return false;
}
}
else if (osxVersion == 12)
else if (osxVersion == 10.12f)
{
if (nugetFramework.Version < new Version(2, 0, 0, 0))
{
return false;
}
}
else if (osxVersion > 12)
else if (osxVersion > 10.12f && osxVersion <= 10.15f)
{
// .NET Core 2.0 is out of support, and doesn't seem to work with OS X 10.14
// (it finds no assets for the RID), even though the support page says "10.12+"
Expand All @@ -173,6 +175,27 @@ public static bool SupportsTargetFramework(string targetFramework)
return false;
}
}
else if (osxVersion == 11.0f)
{
if (nugetFramework.Version < new Version(5, 0, 0, 0))
{
return false;
}
}
else if (osxVersion == 12.0f)
{
if (nugetFramework.Version < new Version(6, 0, 0, 0))
{
return false;
}
}
else if (osxVersion > 12.0f)
{
if (nugetFramework.Version < new Version(7, 0, 0, 0))
{
return false;
}
}
}
}

Expand Down