Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-6158

nuget local repos feeds should support nuspec dependency optional targetFramework attribute

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.7
    • Fix Version/s: 3.0.0-m7
    • Component/s: NuGet
    • Labels:
      None
    • Environment:
      Nuget nuspec version 2
    • Story Points:
      2
    • Sprint:
      Sprint 58 - Föhn

      Description

      Nuspec defines an optional targetFramework attribute as of version 2.0

      http://docs.nuget.org/docs/reference/nuspec-reference#Specifying_Dependencies_in_version_2.0_and_above

      When uploading a nupkg with a nuspec containing this attribute, Nexus does not expose the framework bits in the feed <p:dependencies> element, therefore installing these artifacts from a local nuget repo using visual studio does not work.

      In contrast, downloading a nupkg from a _proxy_ repository feed WILL work because these dependency details include targetFramework details.


      Example:

      1) Download a nupkg which specifies dependencies with targetFramework
      https://www.nuget.org/api/v2/package/Microsoft.AspNet.WebApi.Client/5.0.0

      Results in a file called microsoft.aspnet.webapi.client.5.0.0.nupkg


      1) Boot nexus Pro
      2) Add a local repo of Nuget type
      3) Using the artifact upload tab, upload the nuget artifact into the local nuget repo.
      4) Perform a search against that local nuget repo for the uploaded artifact. The feed entry returned will not contain the targetFramework string inside the dependency element.

      <d:Dependencies>Newtonsoft.Json:4.5.11|Newtonsoft.Json:4.5.11|Microsoft.Net.Http:2.2.13</d:Dependencies>      
      

      Compare this with a proxy Nuget repo of the official feed:
      1) in nexus, add a proxy repo against https://www.nuget.org/api/v2
      2) wait for the download nuget index task to complete ( approx 5-6 minutes )
      3) Perform a search against that proxy nuget repo for the same artifact. The feed entry returned will contain the targetFramework string inside the dependency element.

      <d:Dependencies>Newtonsoft.Json:4.5.11:net45|Newtonsoft.Json:4.5.11:portable-wp80+win+net45|Microsoft.Net.Http:2.2.13:portable-wp80+win+net45</d:Dependencies>
      

      Attached files contain the detailed differences:

      nexus-local.xml feed from local nuget repo
      curl -v "http://localhost:8081/nexus/service/local/nuget/nuget-local/Search%28%29?\$filter=IsLatestVersion&\$skip=0&\$top=30&searchTerm=%27microsoft.aspnet.webapi.client%27&targetFramework=%27net45%27&includePrerelease=false" -o nexus-local.xml -u admin:admin123
      
      nexus-proxy.xml feed from Nexus proxy repo against nuget.org
      curl -v "http://localhost:8081/nexus/service/local/nuget/nuget.org/Search%28%29?\$filter=IsLatestVersion&\$skip=0&\$top=30&searchTerm=%27microsoft.aspnet.webapi.client%27&targetFramework=%27net45%27&includePrerelease=false" -o nexus-proxy.xml -u admin:admin123
      
      nuget.org.xml feed direct from nuget.org
      curl -v "https://www.nuget.org/api/v2/Search%28%29?\$filter=IsLatestVersion&\$skip=0&\$top=30&searchTerm=%27microsoft.aspnet.webapi.client%27&targetFramework=%27net45%27&includePrerelease=false" -o nuget.org.xml
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mprescott Michael Prescott
              Reporter:
              plynch Peter Lynch
              Last Updated By:
              Peter Lynch
              Votes:
              1 Vote for this issue
              Watchers:
              12 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Date of First Response:

                  Time Tracking

                  Estimated:
                  Original Estimate - 32h
                  32h
                  Remaining:
                  Remaining Estimate - 32h
                  32h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified

                    tigCommentSecurity.panel-title