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.

Incorrect NuGet version detection (V2 vs V3)

See original GitHub issue

Description

We are using a private NuGet source repo (feedz.io) which does not include /v3 in the URL for the source. When using Paket, it detects it as a V2 repo even though it should be V3.

This appears to be due to the logic here: https://github.com/fsprojects/Paket/blob/master/src/Paket.Core/Versioning/PackageSources.fs#L148-L151

Note that the code only assumes v3 if the URL has /v3 or is GitHub and ends in index.json. In this case, Feedz.io uses the index.json (which that URL includes the version info) file, but does not use /v3 in their API end points.

This also appears to be the same issue hit by other Paket users, whom have attempted to address (see https://github.com/fsprojects/Paket/pull/3806 and https://github.com/fsprojects/Paket/issues/3575).

Repro steps

Repository at https://github.com/ReedCopsey/paket_bug demonstrates this. Using dotnet paket install gives many errors.

Expected behavior

Paket would resolve this as V3 (somehow) and function properly.

Actual behavior

Significant errors.

Known workarounds

None.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:20 (18 by maintainers)

github_iconTop GitHub Comments

1reaction
tebecocommented, May 5, 2020

i’m not sure doing “url detect” is a good thing to be honest

https://foo-v3-bar/v2/index.json
https://foo-v3-bar/v2/
https://foo-v2-bar/v3/index.json
https://foobar/buzz

they could all be v2 or v3 feed, it’s just a webserver replying to requests I’ve lost hours at work because we spotted paket and artifactory speaking v2 => FindPackageById() with v3 + index.json urls …

An alternative idea would be to allow user to be enforce it like this : source https://foo/bar protocolVersion:3

protocolVersion specified ?

  • use it
  • not compliant => just throw “that source does not seems to be v3”

protocolVersion not specified ?

  • attempt detection, but not too much
  • failfast / throw / indicate that they have to specify protocolVersion on that source

also … I would even go further v2 is kinda deprecated => no version specified ? assume v3 and just throw if not compliant, and ask user to be explictly using v2 it means you can just remove all detection code from paket. Probably near to 0 detection feature bug but yeah … breaking change … still better than URL detection / parsing / contains(v3) or endwith(‘index.json’)

If the idea of paket and lockfile are to have a “clear state” in the lockfile, it means that it should be explicitly written down. As the Protocol Version is part of the source, well that would make sense to write it down in paket.dependencies and then in paket.lock And then the “detection attempt” would not make sense since it’s part of the state, and then predictible

0reactions
tebecocommented, Jun 14, 2020

I’ll try to fix that Url not sure why it was not originally in the unit test to be fair if it was a known “magic one”

do you have idea about other one that could have been forgotten ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

NuGet; unable to get package as wrong version reported in ...
I'm trying to build a solution but I get this error,. he 'Microsoft.Bcl.Build 1.0.14' package requires NuGet client version '2.8.1' or above, ...
Read more >
NuGet Package Version Reference
NuGet considers a package version to be SemVer v2.0.0 specific if ... 2017 version 15.3+; Visual Studio 2015 with NuGet VSIX v3.6.0; dotnet....
Read more >
NuGet adds incorrect package versions for a netstandard ...
If you add a NuGet package to a netstandard project and that NuGet project has dependencies, for some reason VS for Mac chooses...
Read more >
Problems With My NuGet.org Connectors
NuGet.org has deprecated its previous queries to check the status and count of NuGet packages because they are very taxing on the NuGet...
Read more >
The paket.dependencies file
The paket.dependencies file. The paket.dependencies file is used to specify rules regarding your application's dependencies.
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