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 3.3.0 update fails with 'An additional constraint ... defined in packages.config prevents this operation.' #1816

Closed
paiden opened this Issue Dec 9, 2015 · 7 comments

Comments

Projects
None yet
8 participants
@paiden

paiden commented Dec 9, 2015

I tried to switch from NuGet 2.8.60717.93 to 3.3.0.212.

As soon as I do this my build starts to fail with the following error message:
Attempting to gather dependencies information for multiple packages with respect to project 'ProjectName'. Unable to resolve 'PackageName'. An additional constraint '(≥ 5.4.0 && < 5.4.5)' defined in packages.config prevents this operation.

The command that causes the error message is:
NuGet.exe update Project.csproj -configFile .nuget\NuGet.config -id PackageId -RepositoryPath packages

The feed in use definitely contains a package version that satisfies the constraint.

I just need to switch back to the old NuGet version and everything works as expected.

@emgarten

This comment has been minimized.

Show comment
Hide comment
@emgarten

emgarten Dec 9, 2015

Contributor

What version of the package is installed and what versions are available on the feed?
Does the feed show up in the list when running nuget.exe sources ?

Contributor

emgarten commented Dec 9, 2015

What version of the package is installed and what versions are available on the feed?
Does the feed show up in the list when running nuget.exe sources ?

@paiden

This comment has been minimized.

Show comment
Hide comment
@paiden

paiden Dec 10, 2015

What version of the package is installed and what versions are available on the feed?

The installed version is 5.4.3.26485 (which is the highest available version within the constraint)
This is an internal package on a internal feed and there are about 25 package versions that satisfy the constraint.

Does the feed show up in the list when running nuget.exe sources ?

When I run nuget sources -configFile '.nuget\NuGet.config' the feed shows up and is enabled.

paiden commented Dec 10, 2015

What version of the package is installed and what versions are available on the feed?

The installed version is 5.4.3.26485 (which is the highest available version within the constraint)
This is an internal package on a internal feed and there are about 25 package versions that satisfy the constraint.

Does the feed show up in the list when running nuget.exe sources ?

When I run nuget sources -configFile '.nuget\NuGet.config' the feed shows up and is enabled.

@emgarten

This comment has been minimized.

Show comment
Hide comment
@emgarten

emgarten Dec 10, 2015

Contributor

Sounds like a bug. With 2.8.6 the same command results in no operations being performed, correct?

Contributor

emgarten commented Dec 10, 2015

Sounds like a bug. With 2.8.6 the same command results in no operations being performed, correct?

@yishaigalatzer

This comment has been minimized.

Show comment
Hide comment
@yishaigalatzer

yishaigalatzer Dec 10, 2015

Are you able to provide a small repro project for this issue?

yishaigalatzer commented Dec 10, 2015

Are you able to provide a small repro project for this issue?

@yishaigalatzer yishaigalatzer added this to the 3.4 milestone Dec 10, 2015

@paiden

This comment has been minimized.

Show comment
Hide comment
@paiden

paiden Dec 14, 2015

With 2.8.6 the same command results in no operations being performed, correct?

Only on my local system no operations are performed. E.g. on the build server, the package always gets updated (from 0.0.0.0; please don't ask why we do such things ;-) ) correctly (as the build folder is always cleaned).

Are you able to provide a small repro project for this issue?

I will try to try to create a small repro project. As I'm quite busy at the moment and I don't know how easy it is to repro it with a small example (the project where the issue happens has 100+ projects with many NuGet packages served via multiple feeds) it may take some time.

paiden commented Dec 14, 2015

With 2.8.6 the same command results in no operations being performed, correct?

Only on my local system no operations are performed. E.g. on the build server, the package always gets updated (from 0.0.0.0; please don't ask why we do such things ;-) ) correctly (as the build folder is always cleaned).

Are you able to provide a small repro project for this issue?

I will try to try to create a small repro project. As I'm quite busy at the moment and I don't know how easy it is to repro it with a small example (the project where the issue happens has 100+ projects with many NuGet packages served via multiple feeds) it may take some time.

@paiden

This comment has been minimized.

Show comment
Hide comment
@paiden

paiden Jan 22, 2016

I finally found the time to investigate the issue. It seems the problematic code is in NuGetPackageManager.cs around line 709.

prunedAvailablePackages = PrunePackageTree.PruneByUpdateConstraints(prunedAvailablePackages, projectInstalledPackageReferences, resolutionContext.VersionConstraints);

// Remove all but the highest packages that are of the same Id as a specified packageId
if (packageId != null)
{
    prunedAvailablePackages = PrunePackageTree.PruneAllButHighest(prunedAvailablePackages, packageId);

    // And then verify that the installed package is not already of a higher version - this check here ensures the user get's the right error message
    GatherExceptionHelpers.ThrowIfNewerVersionAlreadyReferenced(packageId, projectInstalledPackageReferences, prunedAvailablePackages);
}

The line

prunedAvailablePackages = PrunePackageTree.PruneAllButHighest(prunedAvailablePackages, packageId);

removes the valid packages from the list. Only a newer package that doesn't satisfy the constraint in my case 6.X.X.X is left and therefore causes the error.

So it seems 'PruneByUpdateConstraints' returns packages that don't satisfy the constraint, even if it shouldn't (as far as I can tell).

A small project to repro the issue can be found at: http://1drv.ms/1OKt3OX

paiden commented Jan 22, 2016

I finally found the time to investigate the issue. It seems the problematic code is in NuGetPackageManager.cs around line 709.

prunedAvailablePackages = PrunePackageTree.PruneByUpdateConstraints(prunedAvailablePackages, projectInstalledPackageReferences, resolutionContext.VersionConstraints);

// Remove all but the highest packages that are of the same Id as a specified packageId
if (packageId != null)
{
    prunedAvailablePackages = PrunePackageTree.PruneAllButHighest(prunedAvailablePackages, packageId);

    // And then verify that the installed package is not already of a higher version - this check here ensures the user get's the right error message
    GatherExceptionHelpers.ThrowIfNewerVersionAlreadyReferenced(packageId, projectInstalledPackageReferences, prunedAvailablePackages);
}

The line

prunedAvailablePackages = PrunePackageTree.PruneAllButHighest(prunedAvailablePackages, packageId);

removes the valid packages from the list. Only a newer package that doesn't satisfy the constraint in my case 6.X.X.X is left and therefore causes the error.

So it seems 'PruneByUpdateConstraints' returns packages that don't satisfy the constraint, even if it shouldn't (as far as I can tell).

A small project to repro the issue can be found at: http://1drv.ms/1OKt3OX

@emgarten emgarten assigned johnataylor and unassigned emgarten Jan 22, 2016

@yishaigalatzer yishaigalatzer modified the milestones: 3.4 Beta, 3.4 RTM Feb 25, 2016

@yishaigalatzer yishaigalatzer modified the milestones: 3.4 RTM, 3.4 RTM - Triage, 3.5 Beta Mar 11, 2016

@yishaigalatzer

This comment has been minimized.

Show comment
Hide comment
@yishaigalatzer

yishaigalatzer Mar 11, 2016

We are running out of time for 3.4, John can you please start looking at the Update issues for 3.5?

yishaigalatzer commented Mar 11, 2016

We are running out of time for 3.4, John can you please start looking at the Update issues for 3.5?

@yishaigalatzer yishaigalatzer modified the milestones: 3.5 Beta, 3.5 RC Apr 8, 2016

jainaashish added a commit to jainaashish/NuGet.Client that referenced this issue Apr 14, 2016

Fix NuGet/Home#1816
Removing versions whish don't satisfy allowedVersions before picking the highest version

jainaashish added a commit to NuGet/NuGet.Client that referenced this issue Apr 14, 2016

Fix NuGet/Home#1816
Removing versions whish don't satisfy allowedVersions before picking the highest version

jainaashish added a commit to NuGet/NuGet.Client that referenced this issue Apr 28, 2016

Added more Info as well as Debug logs to investigate performance rela…
…ted issues

Fix NuGet/Home#1816
Removing versions whish don't satisfy allowedVersions before picking the highest version

Fixed PackageResolver to consume updated DateTimeUtility api, also fixed PSPathUtility to pick strings from correct path

jainaashish added a commit to NuGet/NuGet.Client that referenced this issue Apr 29, 2016

jainaashish added a commit to NuGet/NuGet.Client that referenced this issue May 2, 2016

jainaashish added a commit to NuGet/NuGet.Client that referenced this issue May 3, 2016

jainaashish added a commit to jainaashish/NuGet.Client that referenced this issue May 3, 2016

jainaashish added a commit to NuGet/NuGet.Client that referenced this issue May 5, 2016

@jainaashish jainaashish reopened this May 17, 2016

jainaashish added a commit to NuGet/NuGet.Client that referenced this issue May 24, 2016

Fix NuGet/Home#1816
Removing versions whish don't satisfy allowedVersions before picking the highest version

jainaashish added a commit to NuGet/NuGet.Client that referenced this issue May 26, 2016

Fix NuGet/Home#1816
Removing versions whish don't satisfy allowedVersions before picking the highest version

jainaashish added a commit to NuGet/NuGet.Client that referenced this issue May 27, 2016

Fix NuGet/Home#1816
Removing versions whish don't satisfy allowedVersions before picking the highest version

@alpaix alpaix modified the milestones: 3.5 Beta2, 3.5 RC Jun 10, 2016

@rrelyea rrelyea modified the milestones: 3.5 Beta3, 3.5 Beta2 Jun 13, 2016

jainaashish added a commit to NuGet/NuGet.Client that referenced this issue Jun 17, 2016

Fix NuGet/Home#1816
Removing versions whish don't satisfy allowedVersions before picking the highest version

jainaashish added a commit to NuGet/NuGet.Client that referenced this issue Jun 21, 2016

Fix NuGet/Home#1816
Removing versions whish don't satisfy allowedVersions before picking the highest version

@zhili1208 zhili1208 modified the milestones: 3.5 Beta2, 3.5 RTM Jun 22, 2016

@alpaix alpaix modified the milestones: 3.5 RTM, 3.5 Beta2 Jul 25, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment