From d3a72a20755692b01b75b7638fe72d8dfa20d6ea Mon Sep 17 00:00:00 2001 From: Mihai Codoban Date: Mon, 17 Jul 2017 15:53:06 -0700 Subject: [PATCH 1/2] add test project --- .../Core/Core.csproj | 8 +++++ .../Core/Program.cs | 12 +++++++ .../FF/FF.csproj | 8 +++++ .../FF/Program.cs | 12 +++++++ .../SolutionWithProjectDependency.sln | 34 +++++++++++++++++++ .../SolutionWithoutProjectDependency.sln | 31 +++++++++++++++++ 6 files changed, 105 insertions(+) create mode 100644 TestAssets/TestProjects/SolutionBasedProjectDependencies/Core/Core.csproj create mode 100644 TestAssets/TestProjects/SolutionBasedProjectDependencies/Core/Program.cs create mode 100644 TestAssets/TestProjects/SolutionBasedProjectDependencies/FF/FF.csproj create mode 100644 TestAssets/TestProjects/SolutionBasedProjectDependencies/FF/Program.cs create mode 100644 TestAssets/TestProjects/SolutionBasedProjectDependencies/SolutionWithProjectDependency.sln create mode 100644 TestAssets/TestProjects/SolutionBasedProjectDependencies/SolutionWithoutProjectDependency.sln 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 From 9e96ca907b32efc9a149c6f0cf24ead9f110f462 Mon Sep 17 00:00:00 2001 From: Mihai Codoban Date: Mon, 17 Jul 2017 17:10:00 -0700 Subject: [PATCH 2/2] Do not transform solution project dependencies into ProjectReference dependencies Fixes #7075 Fixes https://github.com/Microsoft/msbuild/issues/2274 --- .../build/Microsoft.NET.Sdk.props | 7 +++ ...tionWithSolutionTypeProjectDependencies.cs | 55 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASolutionWithSolutionTypeProjectDependencies.cs 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" + }); + } + } +}