简体   繁体   English

当我从.NET 461中引用.NET Standard NuGet时,为什么要添加成吨的软件包?

[英]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.

相关问题 为什么 NuGet 包中的内容文件作为链接添加到 .NET 核心项目中,您如何防止这种情况发生? - Why are content files from NuGet packages added as links in .NET Core projects and how can you prevent that? .NET Standard NuGet 包是如何实现的? - How are .NET Standard NuGet packages implemented? 来自netstandard 2.0的参考.net461程序集 - Reference .net461 assembly from netstandard 2.0 更新到.NET Standard 2.0 Nuget软件包 - Updating to .NET Standard 2.0 Nuget packages 我可以使用 .NET Standard 来包装 .NET Core NuGet 包并使其在经典 .NET 中可用吗? - Can I use .NET Standard to wrap .NET Core NuGet packages and make them available in classic .NET? 具有自己的NuGet依赖项时如何从Full .Net引用标准库 - How to reference Standard library from Full .Net when it have it's own NuGet dependencies netstandard2.0(.net standard 2.0)类库不能引用net461(.net framework 4.6.1)类库 - netstandard2.0 (.net standard 2.0) class library cannot reference a net461 (.net framework 4.6.1) class library 通过 nuget 与手动参考在 .NET 标准中使用 .NET 框架程序集时的不同错误 - Different errors when using .NET framework assembly in .NET standard via nuget vs manual reference 当.Net Framework + Standard + Core结合使用时,使用PackageReferences管理nuget包 - Manage nuget packages with PackageReferences when .Net Framework+Standard+Core combined .net标准项目中在运行时加载的nuget软件包的查询 - query on nuget packages loading at runtime in .net standard projects
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM