具有依赖项的 nuspec 文件

nuspec file with dependencies

我的公司已经为我们业务专有的包建立了一个 nuget 存储库。我有一个包的 nuspec 文件,其中列出了位于主 nuget 存储库中的依赖项。当我从我们的存储库安装一个包时,依赖项没有安装。

<dependencies>
    <group targetFramework="uap">
        <dependency id="FluentNHibernate" version="2.0.3.0" />
        <dependency id="log4net" version="2.0.8.0" />
        <dependency id="Newtonsoft.Json" version="6.0.0.0" />
        <dependency id="UserModel.SMDC" version="1.0.0.0" />
    <dependency id="Microsoft.AspNet.Identity.Core" version="2.2.1" />
    <dependency id="Microsoft.AspNet.WebPages.Core" version="5.2.3" />
    <dependency id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" />
    <dependency id="Microsoft.AspNet.WebApi.Data" version="3.2.5" />
    <dependency id="Microsoft.AspNet.WebApi.WebData" version="3.2.5" />  
    <dependency id="Npgsql" version="3.2.5" />

    </group>
</dependencies>

我需要做些什么来告诉 "push" 查看主 nuget 站点吗?

Dependencies section is you can specify the other nuget packages to target (as you are doing). Check out the Dependency Groups section in the first link. You likely have the wrong group type specified for your dependencies. Here is a list of the Target Frameworks。我怀疑您可以删除组标签并保留 <dependency> 标签。

这是依赖项的示例(来自您提供的列表):

<dependencies>
  <group>
    <dependency id="log4net" version="2.0.8.0" />
    <dependency id="Newtonsoft.Json" version="6.0.0.0" />
  </group>
  <group targetFramework="net46">
    <dependency id="log4net" version="2.0.8.0" />
    <dependency id="Newtonsoft.Json" version="6.0.0.0" />
    <dependency id="FluentNHibernate" version="2.0.3.0" />
    <dependency id="UserModel.SMDC" version="1.0.0.0" />
    <dependency id="Microsoft.AspNet.Identity.Core" version="2.2.1" />
    <dependency id="Microsoft.AspNet.WebPages.Core" version="5.2.3" />
    <dependency id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" />
    <dependency id="Microsoft.AspNet.WebApi.Data" version="3.2.5" />
    <dependency id="Microsoft.AspNet.WebApi.WebData" version="3.2.5" />  
    <dependency id="Npgsql" version="3.2.5" />
  </group>
</dependencies>

这个例子表明我们需要 log4netNewtonsoft.Json 作为一个非特定组。这是用于所有未指定为目标的组。