简体   繁体   English

.NET 多目标框架将 System.* DLL 复制到 .NET 框架 output 目录

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

I've got a .NET project that targets multiple frameworks, ie, <TargetFrameworks>netstandard2.1;net472</TargetFrameworks>我有一个针对多个框架的 .NET 项目,即<TargetFrameworks>netstandard2.1;net472</TargetFrameworks>

The project contains NuGet packages that bring in System.* dependencies like System.Memory and System.Buffers .该项目包含 NuGet 包,这些包引入了 System.* 依赖项,例如System.MemorySystem.Buffers

When I build the project it creates two output directories, netstandard2.1 and net472 , which is fine.当我构建项目时,它会创建两个 output 目录netstandard2.1net472 ,这很好。

The bit I'm struggling to understand is why does the net472 output directory contain the System.* dependencies?我很难理解的是为什么net472 output 目录包含 System.* 依赖项? 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 (ie, GAC)?我知道它们被复制到netstandard2.1目录,但是为什么当它们可以从机器上的 .NET 框架安装(即 GAC)加载时,它们被复制到 .NET 框架目录?

Is there a way to exclude System.* dlls when for the net472 target?对于net472目标,有没有办法排除 System.* dll?

What you see is ok, as both are nuget packages that are not part of .net framework (yellow instead of green)你看到的是好的,因为两者都是不属于 .net 框架的 nuget 包(黄色而不是绿色)

在此处输入图像描述

在此处输入图像描述

so they need to be copied to output.因此需要将它们复制到 output。

Everything is fine.一切都很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM