Skip to content

Commit

Permalink
Do not transform solution project dependencies into ProjectReference …
Browse files Browse the repository at this point in the history
…dependencies

Fixes dotnet#7075
Fixes dotnet/msbuild#2274
  • Loading branch information
cdmihai committed Jul 18, 2017
1 parent d3a72a2 commit 9e96ca9
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
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"
});
}
}
}

0 comments on commit 9e96ca9

Please sign in to comment.