Paket icon indicating copy to clipboard operation
Paket copied to clipboard

Convert-from-nuget modifies package versions X.Y.0 to X.Y

Open FrenchMigVaz opened this issue 10 years ago • 17 comments

Description

When converting a codebase from NuGet to Paket using the command convert-with-paket, the process does modify package versions formed as X.Y.0 to X.Y This causes no problem when the nuget source is nuget.org, but with Artifactory pro, the restore fails to find version X.Y, while X.Y.0 exists

Repro steps

  1. Using repository https://github.com/Vilmir/ReproPaketMigrationVersionConversion
  2. Run a paket.exe convert-from-nuget command

Expected behavior

Paket shall pin EntityFramework to 6.1.0

Actual behavior

Paket will pin EntityFramework to version 6.1

Resolving packages for group Main:
 - EntityFramework is pinned to 6.1

Restore fails if the nuget source is Artifactory - I cannot share our Artifactory server for repro, it is only available from our Intranet

Known workarounds

I haven't found a workaround. I have tried to run convert-from-nuget --no-install --no-auto-restore and then modify the version in paket.dependencies to 6.1.0, but the restore still fails, trying to look for 6.1

FrenchMigVaz avatar Apr 11 '16 11:04 FrenchMigVaz

Are you talking about the versions in the dependencies file? Can you manually add the 0 and check if install works then?

forki avatar Apr 11 '16 11:04 forki

When running verbose:

Downloading EntityFramework 6.1
  to C:\Users\myuser\AppData\Local\NuGet\Cache\EntityFramework.6.1.0.nupkg
Response from https://myserver/artifactory/api/nuget/myfeed/Packages(Id='EntityFramework',Version='6.1'):

<?xml version='1.0' encoding='UTF-8'?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xml:base="https://myserver/artifactory/api/nuget/myfeed/">
  <id>https://myserver/artifactory/api/nuget/myfeed/Packages(Id='EntityFramework',Version='6.1.0')</id>
  <lowerCaseId>https://myserver/artifactory/api/nuget/myfeed/packages(id='entityframework',version='6.1.0')</lowerCaseId>
  <title type="text">EntityFramework</title>
  <summary type="text">Entity Framework is Microsoft's recommended data access technology for new applications.</summary>
  <updated>2015-10-09T16:15:27Z</updated>
  <author>
    <name>Microsoft</name>
  </author>
  <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='EntityFramework',Version='6.1.0')"/>
  <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='EntityFramework',Version='6.1.0')"/>
  <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
  <content type="application/zip" src="https://myserver/artifactory/api/nuget/myfeed/Download/EntityFramework/6.1.0"/>
  <m:properties xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
    <d:Version>6.1.0</d:Version>
    <d:NormalizedVersion>6.1.0</d:NormalizedVersion>
    <d:LastEdited>
      <iMillis>0</iMillis>
    </d:LastEdited>
    <d:LicenseReportUrl></d:LicenseReportUrl>
    <d:LicenseNames></d:LicenseNames>
    <d:Copyright></d:Copyright>
    <d:Created m:type="Edm.DateTime">2014-03-17T21:38:19.813</d:Created>
    <d:Dependencies></d:Dependencies>
    <d:Description>Entity Framework is Microsoft's recommended data access technology for new applications.</d:Description>
    <d:DownloadCount m:type="Edm.Int32">17030853</d:DownloadCount>
    <d:GalleryDetailsUrl>https://www.nuget.org/packages/EntityFramework/6.1.0</d:GalleryDetailsUrl>
    <d:IconUrl>http://go.microsoft.com/fwlink/?LinkID=386613</d:IconUrl>
    <d:IsLatestVersion m:type="Edm.Boolean">false</d:IsLatestVersion>
    <d:IsAbsoluteLatestVersion m:type="Edm.Boolean">false</d:IsAbsoluteLatestVersion>
    <d:IsPrerelease m:type="Edm.Boolean">false</d:IsPrerelease>
    <d:Language>en-US</d:Language>
    <d:Published m:type="Edm.DateTime">2014-03-17T21:38:19.877</d:Published>
    <d:LicenseUrl>http://go.microsoft.com/fwlink/?LinkID=320539</d:LicenseUrl>
    <d:PackageHash>u/M0OEfqxTUsL5BwzD66eBGm278/ozqdLK3JvMO6QwUxxc+z7ZUkTYm4suDhWRqzkc6mOhvXDQY5dZUwbldxyQ==</d:PackageHash>
    <d:PackageHashAlgorithm>SHA512</d:PackageHashAlgorithm>
    <d:PackageSize m:type="Edm.Int64">12653</d:PackageSize>
    <d:ProjectUrl>http://go.microsoft.com/fwlink/?LinkID=320540</d:ProjectUrl>
    <d:ReportAbuseUrl>https://www.nuget.org/package/ReportAbuse/EntityFramework/6.1.0</d:ReportAbuseUrl>
    <d:ReleaseNotes></d:ReleaseNotes>
    <d:RequireLicenseAcceptance m:type="Edm.Boolean">true</d:RequireLicenseAcceptance>
    <d:Tags>Microsoft EF Database Data O/RM ADO.NET</d:Tags>
    <d:Title>EntityFramework</d:Title>
    <d:VersionDownloadCount m:type="Edm.Int32">1213369</d:VersionDownloadCount>
    <d:Authors>Microsoft</d:Authors>
    <d:MinClientVersion></d:MinClientVersion>
    <d:Summary>Entity Framework is Microsoft's recommended data access technology for new applications.</d:Summary>
  </m:properties>
</entry>
Downloading license for EntityFramework 6.1 to C:\Users\myuser\AppData\Local\NuGet\Cache\EntityFramework.6.1.0.license.html
Something went wrong while downloading EntityFramework 6.1
Message: Could not download EntityFramework 6.1 from https://myserver/artifactory/api/nuget/myfeed/Download/EntityFramework/6.1.0.
    The remote server returned an error: (404) Not Found.

cdrnet avatar Apr 11 '16 11:04 cdrnet

Actual error from artifactory:

{
  "errors" : [ {
    "status" : 404,
    "message" : "my-source-name: Error in getting information for 'EntityFramework.6.1.0.nupkg' (Failed retrieving resource from https://www.nuget.org/api/v2/package/EntityFramework/6.1.0: Connect to api.nuget.org:443 [api.nuget.org/93.184.221.200] failed: Connection refused: connect)."
  } ]
}

Sounds actually more like an issue beween artifactory and public nuget to me.

cdrnet avatar Apr 11 '16 11:04 cdrnet

@cdrnet this is a known issue with many custom servers. Paket tries to work around that - seems we missed a spot.

forki avatar Apr 11 '16 11:04 forki

How can it work around that? I see in verbose that Paket tried 3 times against the same URI, all failing with 404.

cdrnet avatar Apr 11 '16 11:04 cdrnet

@forki I have tried as specified in the workaround session to add the trailing 0, but the paket restore afterwards still tries to fetch 6.1 I have tried to debug in Paket, but I failed to find out where the 6.1.0 becomes 6.1

If you guys know a workaround, I could even use a custom build of Paket to migrate our remaining codebases.

FrenchMigVaz avatar Apr 11 '16 11:04 FrenchMigVaz

I'm already working on a fix. Hope to release in next half hour

forki avatar Apr 11 '16 11:04 forki

@forki you are more reactive than a premium gold support!

FrenchMigVaz avatar Apr 11 '16 11:04 FrenchMigVaz

@cdrnet what is the version that you see in the lock file?

forki avatar Apr 11 '16 12:04 forki

  specs:
    EntityFramework (6.1)

cdrnet avatar Apr 11 '16 12:04 cdrnet

if you manually fix that, does it restore correctly?

if you fix the versions in deps file and run update again, does it fix the lock file?

forki avatar Apr 11 '16 12:04 forki

I pushed a fix that would create the deps file with 6.1.0 instead of 6.1 But since I don't have artifcatory I'm not sure if this is enough.

forki avatar Apr 11 '16 12:04 forki

With v2.58.11.0:

A) No. It now does a lookup for 6.1.0 instead of 6.1, but that results in the same atom feed reply containing the same download URI (6.1.0) which still fails with 404.

B) Yes, it updates the lock file to 6.1.0, but then still fails with 404.

cdrnet avatar Apr 11 '16 12:04 cdrnet

lol so I fixed completely wrong place ;-) what should we do?

forki avatar Apr 11 '16 12:04 forki

I have just tested 2.58.12 and it does resolve the convert with Artifactory as a source.

Thanks!!!

FrenchMigVaz avatar Apr 11 '16 12:04 FrenchMigVaz

So conversion is good but you still see wrong download url from artifactory? Sound like an artifactory bug then On Apr 11, 2016 14:11, "Miguel Vazquez" [email protected] wrote:

I have just tested 2.58.12 and it does resolve the convert with Artifactory as a source.

Thanks!!!

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/fsprojects/Paket/issues/1591#issuecomment-208311663

forki avatar Apr 11 '16 12:04 forki

Yes, this seems to be a weird Artifactory issue, not directly related by the original issue and Paket (NPE actually crashes when trying to download that particular version).

cdrnet avatar Apr 11 '16 13:04 cdrnet