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
13 changes: 0 additions & 13 deletions src/Tasks/Microsoft.NET.Build.Tasks/ResolvePackageAssets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1194,19 +1194,6 @@ private HashSet<string> GetPlatformPackageExclusions()
}
}

// Exclude any runtime frameworks
if (_task.RuntimeFrameworks != null)
{
foreach (var framework in _task.RuntimeFrameworks)
{
var frameworkLibrary = _runtimeTarget.GetLibrary(framework.ItemSpec);
if (frameworkLibrary != null)
{
packageExclusions.UnionWith(_runtimeTarget.GetPlatformExclusionList(frameworkLibrary, libraryLookup));
}
}
}

return packageExclusions;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -661,14 +661,16 @@ Copyright (c) .NET Foundation. All rights reserved.
_DefaultMicrosoftNETPlatformLibrary

.NET Core apps can have shared frameworks that are pre-installed on the target machine, thus the app is "portable"
to any machine that already has the shared framework installed. In order to enable this, a "platform" library
has to be declared. The platform library and its dependencies will be excluded from the runtime assemblies.
to any machine that already has the shared framework installed. For .NET Core 1.x and 2.x, a "platform" library
is declared. The platform library and its dependencies will be excluded from the publish output.

For .NET Core 3 and up, targeting packs and runtime packs are used for shared framework assets instead of PackageReference
============================================================
-->
<Target Name="_DefaultMicrosoftNETPlatformLibrary">

<PropertyGroup Condition="'$(MicrosoftNETPlatformLibrary)' == ''">
<MicrosoftNETPlatformLibrary Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">Microsoft.NETCore.App</MicrosoftNETPlatformLibrary>
<MicrosoftNETPlatformLibrary Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' And '$(_TargetFrameworkVersionWithoutV)' &lt; '3.0'">Microsoft.NETCore.App</MicrosoftNETPlatformLibrary>
</PropertyGroup>

</Target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,41 @@ public void It_uses_lowercase_form_of_the_target_framework_for_the_output_path()
.BeEquivalentTo("netcoreapp1.1");
}

[Fact]
public void BuildWithTransitiveReferenceToNetCoreAppPackage()
{
var testProject = new TestProject()
{
Name = "NetCoreAppPackageReference",
TargetFrameworks = "netcoreapp3.0",
IsSdkProject = true,
IsExe = true
};

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

// The SharpDX package depends on the Microsoft.NETCore.App package
referencedProject.PackageReferences.Add(new TestPackageReference("SharpDX", "4.0.1"));

testProject.ReferencedProjects.Add(referencedProject);

var testAsset = _testAssetsManager.CreateTestProject(testProject, testProject.Name)
.Restore(Log, testProject.Name);

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

buildCommand
.Execute()
.Should()
.Pass();
}

private static bool IsPE32(string path)
{
using (var reader = new PEReader(File.OpenRead(path)))
Expand Down