Skip to content

Commit

Permalink
Merge pull request #1612 from dsplaisted/fix-facades
Browse files Browse the repository at this point in the history
Use .NET Standard facades without reference assembly bit set
  • Loading branch information
dsplaisted committed Oct 10, 2017
2 parents 55cdf8e + 977128f commit 069ab17
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,28 @@ Copyright (c) .NET Foundation. All rights reserved.
targets. -->
<Reference Remove="%(_NETStandardLibraryNETFrameworkLib.FileName)" />

<Reference Include="@(_NETStandardLibraryNETFrameworkLib)">
<!-- netfx.force.conflicts is only needed at compile time. -->
<Private Condition="'%(FileName)' == 'netfx.force.conflicts'">false</Private>
<!-- Put each facade assembly in two separate items: Reference with Private set to false, which means it won't be
copied locally, and ReferenceCopyLocalPaths, which will be copied locally. The reason for this split is to
workaround https://github.com/dotnet/core-setup/issues/2981 by ensuring that the facades are written
to the deps.json with a type of "referenceassembly" instead of "reference".
The exception is netfx.force.conflicts.dll, which shouldn't be copied local. So it isn't included in
ReferenceCopyLocalPaths.
When we add the Reference items, we use the simple name as the ItemSpec, and refer to the full path
to the DLL via the HintPath metadata. This is so that if we're replacing a simple Reference,
the OriginalItemSpec of the resolved reference will match to the Reference that was replaced,
and VS won't show a warning icon on the reference. See https://github.com/dotnet/sdk/issues/1499
-->

<Reference Include="@(_NETStandardLibraryNETFrameworkLib.FileName)">
<HintPath>%(_NETStandardLibraryNETFrameworkLib.Identity)</HintPath>
<Private>false</Private>
</Reference>

<ReferenceCopyLocalPaths Include="@(_NETStandardLibraryNETFrameworkLib)" Condition="'%(FileName)' != 'netfx.force.conflicts'">
<Private>false</Private>
</ReferenceCopyLocalPaths>
</ItemGroup>
</Target>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,16 @@ public void It_supports_copylocal_false_references()
};

testProject.AdditionalProperties.Add("PreserveCompilationContext", "true");
testProject.PackageReferences.Add(new TestPackageReference("NETStandard.Library.NETFramework", "2.0.0-preview2-25330-01", null));

var testReference = new TestProject()
{
Name = "NetStandardLibrary",
TargetFrameworks = "netstandard2.0",
IsSdkProject = true,
IsExe = false
};

testProject.ReferencedProjects.Add(testReference);

var testAsset = _testAssetsManager.CreateTestProject(testProject)
.Restore(Log, testProject.Name);
Expand All @@ -59,7 +68,8 @@ public void It_supports_copylocal_false_references()
.Select(a => a.Split('/').Last())
.ToList();

compileLibraryAssemblyNames.Should().BeEquivalentTo(Net461CompileAssemblies);
compileLibraryAssemblyNames.Should().BeEquivalentTo(
Net461CompileAssemblies.Concat(new[] { testReference.Name + ".dll" }));
}
}

Expand Down

0 comments on commit 069ab17

Please sign in to comment.