Skip to content
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 @@ -22,9 +22,13 @@ Copyright (c) .NET Foundation. All rights reserved.

<ItemGroup>
<!-- We need to find all the files that will be loaded from deps for conflict resolution.
To do this, we look at the files that would be copied local when CopyLocalLockFileAssemblies is true
To do this, we look at the files that would be copied local when CopyLocalLockFileAssemblies is true.
However, if CopyLocalLockFileAssemblies is true, then we don't add these items, as they
will always be included in ReferenceCopyLocalPaths.
-->
<_LockFileAssemblies Include="@(AllCopyLocalItems->WithMetadataValue('Type', 'assembly'))" />
<_LockFileAssemblies Include="@(AllCopyLocalItems->WithMetadataValue('Type', 'assembly'))"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Today, CopyLocalLockFileAssemblies for netcoreapp include shared framework and don't respect other publish filtering mechanisms either. I think that's what you want here, but I also want to fix CopyLocalLockFileAssemblies to be more like "publish in place". See #933

I'm annoyed by the fact that the log can be filled with items called CopyLocal that are not in fact copied anywhere. I'm not pushing back on this change because we're already in that boat, but it's something that's been on my mind for a while.

Condition="'$(CopyLocalLockFileAssemblies)' != 'true'"
/>


<!-- Also include RuntimeTarget items, which aren't included in AllCopyLocalItems, but need to be considered
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,46 @@ public void It_does_not_report_conflicts_if_the_same_framework_assembly_is_refer
.NotHaveStdOutMatching("Encountered conflict", System.Text.RegularExpressions.RegexOptions.CultureInvariant | System.Text.RegularExpressions.RegexOptions.IgnoreCase);
}

[Fact]
public void It_does_not_report_conflicts_when_referencing_a_nuget_package()
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return;
}

var testProject = new TestProject()
{
Name = "DesktopConflictsNuGet",
TargetFrameworks = "net461",
IsSdkProject = true,
IsExe = true
};

var testAsset = _testAssetsManager.CreateTestProject(testProject, testProject.Name)
.WithProjectChanges(p =>
{
var ns = p.Root.Name.Namespace;

var itemGroup = new XElement(ns + "ItemGroup");
p.Root.Add(itemGroup);

itemGroup.Add(new XElement(ns + "PackageReference",
new XAttribute("Include", "NewtonSoft.Json"),
new XAttribute("Version", "9.0.1")));
})
.Restore(Log, testProject.Name);

var buildCommand = new BuildCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name));

buildCommand
.Execute("/v:diag")
.Should()
.Pass()
.And
.NotHaveStdOutMatching("Encountered conflict", System.Text.RegularExpressions.RegexOptions.CultureInvariant | System.Text.RegularExpressions.RegexOptions.IgnoreCase);
}

[Fact]
public void It_generates_binding_redirects_if_needed()
{
Expand Down