Sitelet https://github.com/fsprojects/Paket/issues/2320
Skip to content

paket restore not working with nexus nuget proxy and normalized version number #2320

Description

@PMudra

Description

When I am trying to restore nuget package SourceLink.Fake with version 1.1.0 from a nexus nuget proxy server I get the following error message:

Paket version 4.8.5
Downloading SourceLink.Fake 1.1
Something went wrong while downloading SourceLink.Fake 1.1
Message: Could not download SourceLink.Fake 1.1.
    Couldn't get package details for package SourceLink.Fake 1.1 on http://localhost:8081/repository/nuget.org-proxy.
  ==> Trying again
Downloading SourceLink.Fake 1.1
Something went wrong while downloading SourceLink.Fake 1.1
Message: Could not download SourceLink.Fake 1.1.
    Couldn't get package details for package SourceLink.Fake 1.1 on http://localhost:8081/repository/nuget.org-proxy.
  ==> Last trial
Downloading SourceLink.Fake 1.1
Paket failed with:
        Could not download SourceLink.Fake 1.1.
    Couldn't get package details for package SourceLink.Fake 1.1 on http://localhost:8081/repository/nuget.org-proxy.

SourceLink.Fake is just an example. It will not work for any other package and version with trailing 0.

paket.dependencies

source http://localhost:8081/repository/nuget.org-proxy/
nuget SourceLink.Fake = 1.1.0

paket.lock

NUGET
  remote: http://localhost:8081/repository/nuget.org-proxy
    SourceLink.Fake (1.1)

#1777 might be related.

Repro steps

  1. Install nexus nuget proxy server. Easiest way using docker: docker run -d -p 8081:8081 --name nexus sonatype/nexus3. https://hub.docker.com/r/sonatype/nexus3/
  2. Setup minimal project with paket.exe and paket.dependencies as stated above.
  3. Run .paket/paket.exe install
  4. Delete package/ directory
  5. Run .paket/paket.exe clear-cache
  6. Run .paket/paket.exe restore

See test.zip. Steps 3 and 4 can be skipped when using project in zip file.

Expected behavior

The expected result is that paket restores the needed nuget paket to package/ folder

Actual behavior

An error occurs and the package is not restored.

I believe this is the important part of verbose output of .paket/paket.exe restore (full log: verbose.txt):

Downloading SourceLink.Fake 1.1
Response from http://localhost:8081/repository/nuget.org-proxy/Packages?$filter=(tolower(Id) eq 'sourcelink.fake') and (NormalizedVersion eq '1.1.0'):

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<feed xml:base="http://localhost:8081/repository/nuget.org-proxy/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
  <title type="text">Packages</title>
  <id>http://localhost:8081/repository/nuget.org-proxy/Packages</id>
  <updated>2017-05-08T12:37:06.654Z</updated>
  <link rel="self" title="Packages" href="/sitelet?url=https%3A%2F%2Fgithub.com%2Ffsprojects%2FPaket%2Fissues%2FPackages"/>
  <m:count>0</m:count>
</feed>
Response from http://localhost:8081/repository/nuget.org-proxy/Packages?$filter=(tolower(Id) eq 'sourcelink.fake') and (Version eq '1.1'):

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<feed xml:base="http://localhost:8081/repository/nuget.org-proxy/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
  <title type="text">Packages</title>
  <id>http://localhost:8081/repository/nuget.org-proxy/Packages</id>
  <updated>2017-05-08T12:37:06.890Z</updated>
  <link rel="self" title="Packages" href="/sitelet?url=https%3A%2F%2Fgithub.com%2Ffsprojects%2FPaket%2Fissues%2FPackages"/>
  <m:count>0</m:count>
</feed>
Error while retrieving 'http://localhost:8081/repository/nuget.org-proxy/Packages(Id='SourceLink.Fake',Version='1.1')': System.AggregateException: One or more errors occurred. ---> System.Net.WebException: The remote server returned an error: (404) Not Found.
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.Net.WebClient.GetWebResponse(WebRequest request, IAsyncResult result)
   at System.Net.WebClient.DownloadBitsResponseCallback(IAsyncResult result)
   --- End of inner exception stack trace ---
---> (Inner Exception #0) System.Net.WebException: The remote server returned an error: (404) Not Found.
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.Net.WebClient.GetWebResponse(WebRequest request, IAsyncResult result)
   at System.Net.WebClient.DownloadBitsResponseCallback(IAsyncResult result)<---

I believe the second request should be requesting Version eq '1.1.0' because 1.1.0 is the non-normalized version of the nuget package.

Known workarounds

There are multiple ways to work around this issue:

  1. Do not use nuget proxy but the official nuget.org server
  2. Run .paket/paket.exe update
  3. Delete paket.lock and run .paket/paket.exe install

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions