Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nuspec file with dependencies

Tags:

nuget

nuspec

My company has set up a nuget repository for packages that are proprietary to our business. I have a nuspec file for a package that lists dependencies that are located on the main nuget repository. When I install a package from our repository the dependencies are not installed.

<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>

Is there something I need to do to tell the "push" to look at the main nuget site?

like image 699
Alan Floyd Avatar asked Dec 06 '17 20:12

Alan Floyd


1 Answers

The 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. I would suspect you could remove the group tag and keep the <dependency> tags.

Here is an example of the dependencies (from your provided list):

<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>

This example shows that we need log4net and Newtonsoft.Json as a non-specific group. This is what is used for all groups not specified as the target.

like image 152
techvice Avatar answered Sep 20 '22 05:09

techvice