Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not transform solution project dependencies into ProjectReference dependencies #1422

Closed
wants to merge 2 commits into from
Closed
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
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;

namespace Core
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net451</TargetFramework>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;

namespace FF
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ Copyright (c) .NET Foundation. All rights reserved.
<OverrideToolHost Condition=" '$(DotnetHostPath)' != '' and '$(OverrideToolHost)' == ''">$(DotnetHostPath)</OverrideToolHost>
</PropertyGroup>

<!-- Configure how msbuild handles solution files -->
<PropertyGroup>
<!-- Do not transform solution project dependencies into ProjectReference dependencies
https://github.com/Microsoft/msbuild/issues/2274 -->
<AddSyntheticProjectReferencesForSolutionDependencies Condition=" '$(AddSyntheticProjectReferencesForSolutionDependencies)' == '' ">false</AddSyntheticProjectReferencesForSolutionDependencies>
</PropertyGroup>

<!-- Workaround: https://github.com/dotnet/sdk/issues/1001 -->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "/>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "/>
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
});
}
}
}