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

Add DisableImplicitTransitiveReferences #1751

Merged
merged 2 commits into from
Nov 20, 2017
Merged
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
Expand Up @@ -462,6 +462,7 @@ Copyright (c) .NET Foundation. All rights reserved.
-->

<Target Name="_ComputeTransitiveProjectReferences"
Condition="'$(DisableTransitiveProjectReferences)' != 'true'"
DependsOnTargets="_ComputeActiveTFMPackageDependencies"
Returns="_TransitiveProjectReferences">
<ItemGroup>
Expand All @@ -479,6 +480,7 @@ Copyright (c) .NET Foundation. All rights reserved.
</Target>

<Target Name="IncludeTransitiveProjectReferences"
Condition="'$(DisableTransitiveProjectReferences)' != 'true'"
DependsOnTargets="_ComputeTransitiveProjectReferences" >
<ItemGroup>
<!-- Add the references we computed -->
Expand Down Expand Up @@ -593,4 +595,4 @@ Copyright (c) .NET Foundation. All rights reserved.

</Target>

</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,28 @@ public void The_clean_target_removes_all_files_from_the_output_folder()

outputDirectory.Should().OnlyHaveFiles(Array.Empty<string>());
}

[Fact]
public void It_does_not_build_the_project_successfully()
{
// NOTE the project dependencies in AppWithTransitiveProjectRefs:
// TestApp --depends on--> MainLibrary --depends on--> AuxLibrary
// (TestApp transitively depends on AuxLibrary)

var testAsset = _testAssetsManager
.CopyTestAsset("AppWithTransitiveProjectRefs", "BuildAppWithTransitiveProjectRefDisabled")
.WithSource();

testAsset.Restore(Log, "TestApp");
testAsset.Restore(Log, "MainLibrary");
testAsset.Restore(Log, "AuxLibrary");

var appProjectDirectory = Path.Combine(testAsset.TestRoot, "TestApp");
var buildCommand = new BuildCommand(Log, appProjectDirectory);
buildCommand
.Execute("/p:DisableTransitiveProjectReferences=true")
.Should()
.Fail();
}
}
}