Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NuGet.exe does not resolve to the latest version of a package when using * in PackageReference (MSBuild/Dotnet/VS restore do) #8432

Closed
realrubberduckdev opened this issue Aug 7, 2019 · 3 comments · Fixed by NuGet/NuGet.Client#3079
Assignees
Labels
Milestone

Comments

@realrubberduckdev
Copy link

realrubberduckdev commented Aug 7, 2019

Details about Problem

Please note this is the same issue described in #6640. But please do check the repro steps as it doesn't actually work. Unsure how it worked then.

Issue is if packagereference is set to "*" then it resolves to lowest available version and not highest one. In #6640 the discussion seems to suggest that highest version should be picked up.

What is the recommended method to get packagereference to resolve to highest available version?
This is a very useful feature, say if we are doing integration testing with latest available package.

NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe):
NuGet.exe

NuGet version (x.x.x.xxx):
5.0.2.5988

dotnet.exe --version (if appropriate):

VS version (if appropriate):

OS version (i.e. win10 v1607 (14393.321)):
Win 10 Pro 1803

Worked before? If so, with which NuGet version:
It has been suggested in #6640 that it used to work. But it has never worked for me.

Detailed repro steps so we can see the same problem

  1. Create an empty folder

  2. Add test.csproj using the xml below

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net45</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Selenium.WebDriver" Version="*"/>
  </ItemGroup>
</Project>
  1. To start from a clean state, from a prompt run
    nuget locals all -clear

  2. Do a nuget restore with detailed output
    nuget restore -Verbosity detailed .\test.csproj

See that Selenium.WebDriver has resolved to 2.2.0 and not the latest available package version on nuget.org.
Acquired lock for the installation of Selenium.WebDriver 2.2.0

What is the recommended mechanism to be able to resolve to latest available package version using package reference?

@zivkan
Copy link
Member

zivkan commented Aug 8, 2019

msbuild -t:restore and dotnet restore work correctly on my machine, and I was able to repro the bug with nuget restore. If your solution does not contain any packages.config projects, then I suggest you use msbuild or dotnet restore instead of nuget restore. Otherwise, I suggest doing one of these other restores after a nuget restore until the bug is fixed.

@zivkan zivkan added Product:NuGet.exe NuGet.exe Functionality:Restore Type:Bug Priority:2 Issues for the current backlog. labels Aug 8, 2019
@zivkan zivkan added this to the 5.3 milestone Aug 8, 2019
@nkolev92 nkolev92 self-assigned this Aug 12, 2019
@nkolev92
Copy link
Member

I'd imagine it works with everything but *.

Namely I'd imagine 3.* works as expected.

The root cause is the same as #8073 and #6697.

@nkolev92
Copy link
Member

This won't land in 5.3.

@nkolev92 nkolev92 changed the title Reference latest version of nuget package using PackageReference NuGet.exe does not resolve to the latest version of a package when using * in PackageReference (MSBuild/Dotnet/VS restore do) Oct 4, 2019
@nkolev92 nkolev92 modified the milestones: Backlog, 5.5 Oct 23, 2019
@zkat zkat reopened this Mar 18, 2020
@zkat zkat closed this as completed Mar 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants