diff --git a/TestAssets/DesktopTestProjects/NETFrameworkReferenceNETStandard20/TestApp/Program.cs b/TestAssets/DesktopTestProjects/NETFrameworkReferenceNETStandard20/TestApp/Program.cs new file mode 100644 index 000000000..a168da37c --- /dev/null +++ b/TestAssets/DesktopTestProjects/NETFrameworkReferenceNETStandard20/TestApp/Program.cs @@ -0,0 +1,15 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; + +namespace TestApp +{ + class Program + { + public static void Main(string[] args) + { + Console.WriteLine(TestLibrary.Helper.GetMessage()); + } + } +} diff --git a/TestAssets/DesktopTestProjects/NETFrameworkReferenceNETStandard20/TestApp/TestApp.csproj b/TestAssets/DesktopTestProjects/NETFrameworkReferenceNETStandard20/TestApp/TestApp.csproj new file mode 100644 index 000000000..4f3707aba --- /dev/null +++ b/TestAssets/DesktopTestProjects/NETFrameworkReferenceNETStandard20/TestApp/TestApp.csproj @@ -0,0 +1,12 @@ + + + + Exe + net461 + + + + + + + diff --git a/TestAssets/DesktopTestProjects/NETFrameworkReferenceNETStandard20/TestLibrary/Helper.cs b/TestAssets/DesktopTestProjects/NETFrameworkReferenceNETStandard20/TestLibrary/Helper.cs new file mode 100644 index 000000000..67b32cfdb --- /dev/null +++ b/TestAssets/DesktopTestProjects/NETFrameworkReferenceNETStandard20/TestLibrary/Helper.cs @@ -0,0 +1,24 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; + +namespace TestLibrary +{ + public static class Helper + { + /// + /// Gets the message from the helper. This comment is here to help test XML documentation file generation, please do not remove it. + /// + /// A message + public static string GetMessage() + { + return "This string came from the test library!"; + } + + public static void SayHi() + { + Console.WriteLine("Hello there!"); + } + } +} \ No newline at end of file diff --git a/TestAssets/DesktopTestProjects/NETFrameworkReferenceNETStandard20/TestLibrary/TestLibrary.csproj b/TestAssets/DesktopTestProjects/NETFrameworkReferenceNETStandard20/TestLibrary/TestLibrary.csproj new file mode 100644 index 000000000..9f5c4f4ab --- /dev/null +++ b/TestAssets/DesktopTestProjects/NETFrameworkReferenceNETStandard20/TestLibrary/TestLibrary.csproj @@ -0,0 +1,7 @@ + + + + netstandard2.0 + + + diff --git a/test/EndToEnd/GivenNetFrameworkSupportsNetStandard2.cs b/test/EndToEnd/GivenNetFrameworkSupportsNetStandard2.cs new file mode 100644 index 000000000..97398a685 --- /dev/null +++ b/test/EndToEnd/GivenNetFrameworkSupportsNetStandard2.cs @@ -0,0 +1,40 @@ +using FluentAssertions; +using Microsoft.DotNet.TestFramework; +using Microsoft.DotNet.Tools.Test.Utilities; +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; + +namespace EndToEnd +{ + public class GivenNetFrameworkSupportsNetStandard2 : TestBase + { + [WindowsOnlyFact] + public void ANET461ProjectCanReferenceANETStandardProject() + { + var _testInstance = TestAssets.Get(TestAssetKinds.DesktopTestProjects, "NETFrameworkReferenceNETStandard20") + .CreateInstance() + .WithSourceFiles(); + + string projectDirectory = Path.Combine(_testInstance.Root.FullName, "TestApp"); + + new RestoreCommand() + .WithWorkingDirectory(projectDirectory) + .Execute() + .Should().Pass(); + + new BuildCommand() + .WithWorkingDirectory(projectDirectory) + .Execute() + .Should().Pass(); + + new RunCommand() + .WithWorkingDirectory(projectDirectory) + .ExecuteWithCapturedOutput() + .Should().Pass() + .And.HaveStdOutContaining("This string came from the test library!"); + + } + } +}