简体   繁体   English

Nuget nuspec指定私有依赖

[英]Nuget nuspec specify private dependency

Essentially this . 基本上就是这个

I have a NuGet package that has a dependency, it gets installed alongside the package. 我有一个具有依赖关系的NuGet包,它与包一起安装。 However, NuGet adds both the package and recursive dependency package as a reference. 但是,NuGet添加了包和递归依赖包作为参考。

MsBuild has the <private> tag to distinguish one type of dependency from the other, has NuGet been changed in the last 5 years to support this? MsBuild有<private>标签来区分一种类型的依赖关系,NuGet在过去的5年中是否已经改变以支持这种情况?

I can't find any hints that it does. 我找不到它的任何提示。

Tx TX

If you are using the PackageReference format of referencing NuGet packages (instead of packages.config), it allows to control the assets consumed by the project and forwarded to dependencies per referenced package. 如果您使用引用NuGet包(而不是packages.config)的PackageReference格式 ,则它允许控制项目使用的资产并转发到每个引用包的依赖项。 This also allows to sepcify that all assets of the package are "private" which causes the reference to not be added to the packed nupkg: 这也允许sepcify包的所有资产都是“私有”,这导致引用不被添加到打包的nupkg:

<ItemGroup>
  <PackageReference Include="My.BuildTimeOnly.Dependency" 
                    Version="1.2.3"
                    PrivateAssets="all" />
</ItemGroup>

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

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