.NET multi target frameworks copies System.* DLLs to .NET Framework output directory

839 views Asked by At

I've got a .NET project that targets multiple frameworks, i.e., <TargetFrameworks>netstandard2.1;net472</TargetFrameworks>

The project contains NuGet packages that bring in System.* dependencies like System.Memory and System.Buffers.

When I build the project it creates two output directories, netstandard2.1 and net472, which is fine.

The bit I'm struggling to understand is why does the net472 output directory contain the System.* dependencies? I understand them being copied to the netstandard2.1 directory, but why are they copied for the .NET Framework directory when they can be loaded from the .NET Framework installation on the machine (i.e., GAC)?

Is there a way to exclude System.* dlls when for the net472 target?

1

There are 1 answers

2
magicandre1981 On

What you see is ok, as both are nuget packages that are not part of .net framework (yellow instead of green)

enter image description here

enter image description here

so they need to be copied to output.

Everything is fine.