diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAHelloWorldProject.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAHelloWorldProject.cs index bb4becb82b88..2a2b998bc84c 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAHelloWorldProject.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAHelloWorldProject.cs @@ -70,10 +70,16 @@ public void It_publishes_portable_apps_to_the_publish_folder_and_the_app_should_ } [Theory] + [InlineData("netcoreapp1.1")] [InlineData("netcoreapp2.0")] [InlineData(ToolsetInfo.CurrentTargetFramework)] 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 diff --git a/src/Tests/Microsoft.NET.TestFramework/EnvironmentInfo.cs b/src/Tests/Microsoft.NET.TestFramework/EnvironmentInfo.cs index 37dc94829f68..8fbd09685e61 100644 --- a/src/Tests/Microsoft.NET.TestFramework/EnvironmentInfo.cs +++ b/src/Tests/Microsoft.NET.TestFramework/EnvironmentInfo.cs @@ -54,7 +54,21 @@ public static string GetCompatibleRid(string targetFramework = null) // able to run on the current OS public static bool SupportsTargetFramework(string targetFramework) { - var nugetFramework = NuGetFramework.Parse(targetFramework); + NuGetFramework nugetFramework = null; + try + { + nugetFramework = NuGetFramework.Parse(targetFramework); + } + catch + { + return false; + } + + if (nugetFramework == null) + { + return false; + } + string currentRid = RuntimeInformation.RuntimeIdentifier; string ridOS = currentRid.Split('.')[0];