paket restore not working with nexus nuget proxy and normalized version number
See original GitHub issueDescription
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
- 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/ - Setup minimal project with paket.exe and paket.dependencies as stated above.
- Run
.paket/paket.exe install
- Delete package/ directory
- Run
.paket/paket.exe clear-cache
- 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:
- Do not use nuget proxy but the official nuget.org server
- Run
.paket/paket.exe update
- Delete paket.lock and run
.paket/paket.exe install
Issue Analytics
- State:
- Created 6 years ago
- Comments:14 (11 by maintainers)
Top GitHub Comments
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.
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.