question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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="Packages"/>
  <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="Packages"/>
  <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

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
forkicommented, Jul 11, 2017

I just released paket 5.6.3 with a fix. But I assume it’s a bug in sonatype since NormalizedVersion is 1.1.0 and it can’t retrieve that. please also report it with sonatype directly.

0reactions
PMudracommented, Jul 11, 2017

Thanks for the fix. I tried again and it is working now!

I found this issue on sonatypes jira: https://issues.sonatype.org/browse/NEXUS-6159 The missing NormalizedVersion is mentioned there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet restore fails when using nuget proxy on nexus
The packages are being restored just fine until NuGet.Frameworks.4.7.0 . This package exists in 5 different versions (as far as I can tell...
Read more >
Nuget package restore failed
Visual studio stating packages failed to restore after an attempt to download nuget package. Any idea what is wrong here?
Read more >
Troubleshooting NuGet Package Restore in Visual Studio
Use NuGet Package Restore to download them. The missing file is {name}. This error occurs when you attempt to build a project that...
Read more >
FAQ — Frequently Asked Questions
No, since Paket provides a global view of your dependencies it usually installs only one version of a package and therefore the version...
Read more >
Untitled
No demores j alvarez download, Stablemates pdf download, Firefly float out pdf ... Visualizzatore file dwg extension, Three hinged arch problems pdf reader, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found