diff --git a/TestAssets/TestProjects/SolutionBasedProjectDependencies/Core/Core.csproj b/TestAssets/TestProjects/SolutionBasedProjectDependencies/Core/Core.csproj new file mode 100644 index 000000000000..abb9969a56c4 --- /dev/null +++ b/TestAssets/TestProjects/SolutionBasedProjectDependencies/Core/Core.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp1.1 + + + diff --git a/TestAssets/TestProjects/SolutionBasedProjectDependencies/Core/Program.cs b/TestAssets/TestProjects/SolutionBasedProjectDependencies/Core/Program.cs new file mode 100644 index 000000000000..ae908c0a5080 --- /dev/null +++ b/TestAssets/TestProjects/SolutionBasedProjectDependencies/Core/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace Core +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/TestAssets/TestProjects/SolutionBasedProjectDependencies/FF/FF.csproj b/TestAssets/TestProjects/SolutionBasedProjectDependencies/FF/FF.csproj new file mode 100644 index 000000000000..149d2ed33081 --- /dev/null +++ b/TestAssets/TestProjects/SolutionBasedProjectDependencies/FF/FF.csproj @@ -0,0 +1,8 @@ + + + + Exe + net451 + + + diff --git a/TestAssets/TestProjects/SolutionBasedProjectDependencies/FF/Program.cs b/TestAssets/TestProjects/SolutionBasedProjectDependencies/FF/Program.cs new file mode 100644 index 000000000000..e57efd88419e --- /dev/null +++ b/TestAssets/TestProjects/SolutionBasedProjectDependencies/FF/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace FF +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/TestAssets/TestProjects/SolutionBasedProjectDependencies/SolutionWithProjectDependency.sln b/TestAssets/TestProjects/SolutionBasedProjectDependencies/SolutionWithProjectDependency.sln new file mode 100644 index 000000000000..522cd82f2063 --- /dev/null +++ b/TestAssets/TestProjects/SolutionBasedProjectDependencies/SolutionWithProjectDependency.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26709.3000 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core", "Core\Core.csproj", "{334778F6-6AC6-4BBA-AC3A-0D9AF15503EE}" + ProjectSection(ProjectDependencies) = postProject + {5BDF9C4F-F6FA-4DD3-8F60-0FE79B7A77A3} = {5BDF9C4F-F6FA-4DD3-8F60-0FE79B7A77A3} + EndProjectSection +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FF", "FF\FF.csproj", "{5BDF9C4F-F6FA-4DD3-8F60-0FE79B7A77A3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {334778F6-6AC6-4BBA-AC3A-0D9AF15503EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {334778F6-6AC6-4BBA-AC3A-0D9AF15503EE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {334778F6-6AC6-4BBA-AC3A-0D9AF15503EE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {334778F6-6AC6-4BBA-AC3A-0D9AF15503EE}.Release|Any CPU.Build.0 = Release|Any CPU + {5BDF9C4F-F6FA-4DD3-8F60-0FE79B7A77A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5BDF9C4F-F6FA-4DD3-8F60-0FE79B7A77A3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5BDF9C4F-F6FA-4DD3-8F60-0FE79B7A77A3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5BDF9C4F-F6FA-4DD3-8F60-0FE79B7A77A3}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {043BCE42-2F98-45AD-98DA-3654AEED348A} + EndGlobalSection +EndGlobal diff --git a/TestAssets/TestProjects/SolutionBasedProjectDependencies/SolutionWithoutProjectDependency.sln b/TestAssets/TestProjects/SolutionBasedProjectDependencies/SolutionWithoutProjectDependency.sln new file mode 100644 index 000000000000..5e3e94b1d76e --- /dev/null +++ b/TestAssets/TestProjects/SolutionBasedProjectDependencies/SolutionWithoutProjectDependency.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26709.3000 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core", "Core\Core.csproj", "{334778F6-6AC6-4BBA-AC3A-0D9AF15503EE}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FF", "FF\FF.csproj", "{5BDF9C4F-F6FA-4DD3-8F60-0FE79B7A77A3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {334778F6-6AC6-4BBA-AC3A-0D9AF15503EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {334778F6-6AC6-4BBA-AC3A-0D9AF15503EE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {334778F6-6AC6-4BBA-AC3A-0D9AF15503EE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {334778F6-6AC6-4BBA-AC3A-0D9AF15503EE}.Release|Any CPU.Build.0 = Release|Any CPU + {5BDF9C4F-F6FA-4DD3-8F60-0FE79B7A77A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5BDF9C4F-F6FA-4DD3-8F60-0FE79B7A77A3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5BDF9C4F-F6FA-4DD3-8F60-0FE79B7A77A3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5BDF9C4F-F6FA-4DD3-8F60-0FE79B7A77A3}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {043BCE42-2F98-45AD-98DA-3654AEED348A} + EndGlobalSection +EndGlobal diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.Sdk.props b/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.Sdk.props index a8fd34dd3221..f00698d03d6c 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.Sdk.props +++ b/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.Sdk.props @@ -127,6 +127,13 @@ Copyright (c) .NET Foundation. All rights reserved. $(DotnetHostPath) + + + + false + + diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASolutionWithSolutionTypeProjectDependencies.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASolutionWithSolutionTypeProjectDependencies.cs new file mode 100644 index 000000000000..59bf2d47ca91 --- /dev/null +++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASolutionWithSolutionTypeProjectDependencies.cs @@ -0,0 +1,55 @@ +// 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.IO; +using Microsoft.NET.TestFramework; +using Microsoft.NET.TestFramework.Assertions; +using Microsoft.NET.TestFramework.Commands; +using Xunit; +using Xunit.Abstractions; + +namespace Microsoft.NET.Build.Tests +{ + public class GivenThatWeWantToBuildASolutionWithSolutionTypeProjectDependencies : SdkTest + { + public GivenThatWeWantToBuildASolutionWithSolutionTypeProjectDependencies(ITestOutputHelper log) : base(log) + { + } + + [Fact] + public void It_builds_solution_successfully() + { + var testAsset = _testAssetsManager + .CopyTestAsset("SolutionBasedProjectDependencies") + .WithSource(); + + testAsset.Restore(Log, Path.Combine(testAsset.TestRoot, "SolutionWithProjectDependency.sln")); + + var buildCommand = new BuildCommand(Log, testAsset.TestRoot, "SolutionWithProjectDependency.sln"); + buildCommand + .Execute() + .Should() + .Pass(); + + var netCoreProjectOutput = new DirectoryInfo(Path.Combine(testAsset.Path, "Core", "bin", "Debug", "netcoreapp1.1")); + var fullFrameworkProjectOutput = new DirectoryInfo(Path.Combine(testAsset.Path, "FF", "bin", "Debug", "net451")); + + netCoreProjectOutput + .Should() + .OnlyHaveFiles(new[] { + "Core.runtimeconfig.dev.json", + "Core.runtimeconfig.json", + "Core.deps.json", + "Core.dll", + "Core.pdb" + }); + + fullFrameworkProjectOutput + .Should() + .OnlyHaveFiles(new[] { + "FF.exe", + "FF.pdb" + }); + } + } +}