Home: PMC: Update-Package reinstall fails ("Unable to find package") on delisted packages.

Created on 4 Sep 2018  路  10Comments  路  Source: NuGet/Home

Using NuGet Package Manager 4.6.0, VS 15.8.2, Update-Package -Reinstall fails for a package that installs & uninstalls & installs fine.

Repro:

  1. Legacy csproj, target .NET 4.6.2
  2. Install-Package ReactiveUI -Version 6.5.0
  3. Update-Package -Reinstall

Outcome

Attempting to resolve dependencies for multiple packages.
Update-Package : Unable to find package 'reactiveui'. Existing packages must be restored before performing an install or update.

Used package source https://api.nuget.org/v3/index.json. NuGet package cache, HTTP cache cleared. All queries made during reinstall against NuGet HTTP API resolve with 200 OK.

Edit: The package & some of the dependencies are delisted packages.

Edit 2: Ok, I see that ResolutionContext.IncludeUnlisted is set to false in the UpdatePackageCommand (NuGet.PackageManagement.PowerShellCmdlets assembly) cmdlet. So is this intentional and by design? Could an override flag be added?

Install Update 2 VS.PMConsole Packages.Config Bug

Most helpful comment

5.0? Will that be available for VS 2017? I'm not really willing or able to tolerate another unstable release of VS.

All 10 comments

@jokokko Thanks for opening the issue! I was able to reproduce this issue. Unlisted packages should not be updatable, but you should be able to install them if you provide a specific version.

Update-Package -Resinstall is a special version of the Update-Package cmdlet that is not actually an update, therefore here it does make sense that the behavior is the same as uninstalling and installing the package.

I don't think the Resolutioncontext.IncludeUnlisted set to false makes a difference, because the InstallPackageCommand has this same property set to false and it does work in this case. We would be happy to accept a PR that fixes this issue for Update-Package -Reinstall!

@PatoBeltran ah, thanks (I'm a complete idiot and didn't realize the tooling is OSS... Was just going with dism & decompile). With the wanted behaviour acked, I'll follow with PR or somebody faster than me does.

@jainaashish - was this closed as fixed? I think I'm seeing a regression if it is.

@jokokko @nkolev92 @jainaashish Was this fix included in latest NuGet release?

It's in 5.0 (VS 2019 equivalent) which is still in preview.

5.0? Will that be available for VS 2017? I'm not really willing or able to tolerate another unstable release of VS.

@jokokko @nkolev92 @jainaashish

Update-Package package-name also gives the below error in VS2017 (15.9.0).

Error 1: Update-package : Unable to resolve dependencies. 'XXX.YY 6.3.0.2' is not compatible with 'YY.ZZ 6.4.0.5 constraint:

Error 2: Update-package : Unable to find package 'XXX.YY'. Existing packages must be restored before performing an install or update.

Was this issue fixed in latest NuGet release?

I was pulling my hair out trying to figure out why nuget reinstall wasn't working for one of my projects, switched to VS2019 and it worked first try. Thanks for fixing this @jokokko 馃憤

Hi GUys,

How this issue has been marked as closed?

https://github.com/NuGet/Home/issues/7425

Still, am getting the below error in Visual Studio 2019 with NuGet Package Manager 5.0.

Update-Package -Id {PackageName} 鈥搑einstall

Error 1: Update-package : Unable to resolve dependencies. 'XXX.YY 6.3.0.2' is not compatible with 'YY.ZZ 6.4.0.5 constraint:

Error 2: Update-package : Unable to find package 'XXX.YY'. Existing packages must be restored before performing an install or update.

How to reopen this?

@vadivel1234 The logs you are reporting does not look like it's related to this issue.

The error message there suggests that NuGet cannot resolve the graph due to bad constraints.

There's a few reasons why it could've worked once but not anymore.

  • The package on the feed changed (nuget.org doesn't allow this), but other feeds might
  • Manual changes were made to the packages.config / csproj files.
Was this page helpful?
0 / 5 - 0 ratings