[英]Why are tons of packages added when I reference a .NET Standard NuGet from within .NET 461?
I have a .NET 461 project that references a NuGet targeting .NET Standard 1.6. 我有一个.NET 461项目,该项目引用了一个针对.NET Standard 1.6的NuGet。
As i've understood by this answer , referecing this NuGet will cause my .NET 461 projects packages.config to look like the following: 正如我对这个答案的理解,引用此NuGet将使我的.NET 461项目packages.config看起来如下所示:
<packages>
...
<package id="NETStandard.Library" version="1.6.1" targetFramework="net46" />
...
</packages>
Actually, it looks more like this (there's like atleast 10 more that I haven't included here for simplicity): 实际上,它看起来更像这样(为简单起见,这里至少还包括10个):
<packages>
...
<package id="NETStandard.Library" version="1.6.1" targetFramework="net46" />
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net46" />
<package id="System.AppContext" version="4.3.0" targetFramework="net46" />
<package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net46" />
...
</packages>
Is it NETStandard.Library
that automagically references all these? 是
NETStandard.Library
自动引用所有这些信息吗? I cannot find any information about this. 我找不到有关此的任何信息。
One of the recent improvements where packages we're moved from being referenced in packages.config
to being referenced in project files was that they could implement a change wherein only your direct project dependencies are included in the file. 将包从
packages.config
中的引用移到项目文件中的引用的最新改进之一是,它们可以实现更改,其中文件中仅包含您直接的项目依赖项。 Packages that those dependencies rely upon do not appear in the project file. 这些依赖项依赖的软件包不会出现在项目文件中。
However, your snippet suggests that you're still using a packages.config
file - in which case all dependencies in the transitive closure get included in the file, unfortunately, for backwards compatibility reasons. 但是,您的代码段表明您仍在使用
packages.config
文件-不幸的是,出于向后兼容的原因,在这种情况下,传递闭包中的所有依赖项都包含在文件中。
Which specific packages you directly referenced (and which of those caused a particular package to appear in the packages.config due to a dependency) aren't recorded in this file. 您直接引用了哪些特定程序包(以及哪些依赖项导致了特定程序包出现在packages.config中)没有记录在此文件中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.