简体   繁体   English

在 NuGet 打包期间如何忽略依赖项 .Net Core?

[英]How to ignore dependencies .Net Core during NuGet packaging?

I have my own nuget packages located on a disk (local Nuget).我在磁盘(本地 Nuget)上有自己的 nuget 包。 i'm trying to not add the same dll multiple times and get in a scenario like the image attached我试图不多次添加相同的 dll 并进入类似于附加图像的场景

i have tried the following code during packing but doesn't work我在打包过程中尝试了以下代码但不起作用

  dotnet pack PathtoSolution\SystemCore.Services.Data --no-dependencies --output "G:\NuGetPackages"

however during restoration to another project the dependency comes back.但是在恢复到另一个项目的过程中,依赖又回来了。

在此处输入图片说明

is there a way to not include dependencies during the packing process or is ignoring at installation time my only option?有没有办法在打包过程中不包含依赖项,或者在安装时忽略我唯一的选择?

You can add to your PackageReference PrivateAssets="all" - however this has some undesirable effects as well as you won't be able to access the types defined in those assemblies outside of your nuget package.您可以添加到您的 PackageReference PrivateAssets="all" - 但是这会产生一些不良影响,并且您将无法访问 nuget 包之外的那些程序集中定义的类型。 If that's ok with you, it would work.如果你没问题,那就行了。

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

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