Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

error NU1605: Detected package downgrade #325

Closed
AnthonySteele opened this issue Jul 11, 2018 · 7 comments
Closed

error NU1605: Detected package downgrade #325

AnthonySteele opened this issue Jul 11, 2018 · 7 comments
Labels

Comments

@AnthonySteele
Copy link
Member

In the AWS Watchman runs, NuKeeper has been failing with errors as below.

I'm not sure what's causing it. It is correct to attempt to update AWSSDK.Core first, as it is upstream of the other AWSSDK.* packages.

But it might be that when the projects relate to each other and with the new package model have tree of project and package dependencies, it matter which project is updated first - i.e. it should be the upstream project first?


Selection of package updates: 12 candiates, filtered to 10, capped at 3
Selected package update of AWSSDK.Core to 3.3.24.3
Selected package update of AWSSDK.DynamoDBv2 to 3.3.10.3
Selected package update of AWSSDK.CloudWatch to 3.3.6.6
Nuget restore on /tmp/NuKeeper/c40c2eb6aaa746038d80b150d713d6ab AwsWatchman.sln
Cannot run NuGet.exe file restore as OS Platform is not Windows
Updating 'AWSSDK.Core' from 3.3.22.5 to 3.3.24.3 in 3 projects
Update failed Exception : Exit code: 1

  Restoring packages for /tmp/NuKeeper/c40c2eb6aaa746038d80b150d713d6ab/Watchman.AwsResources/Watchman.AwsResources.csproj...
  Restore completed in 290.79 ms for /tmp/NuKeeper/c40c2eb6aaa746038d80b150d713d6ab/Watchman.AwsResources/Watchman.AwsResources.csproj.
  Restore completed in 0.84 ms for /tmp/NuKeeper/c40c2eb6aaa746038d80b150d713d6ab/Watchman.Configuration/Watchman.Configuration.csproj.
  Restoring packages for /tmp/NuKeeper/c40c2eb6aaa746038d80b150d713d6ab/Watchman.Engine/Watchman.Engine.csproj...
/tmp/NuKeeper/c40c2eb6aaa746038d80b150d713d6ab/Watchman.Engine/Watchman.Engine.csproj : error NU1605: Detected package downgrade: AWSSDK.Core from 3.3.24.3 to 3.3.22.5. Reference the package directly from the project to select a different version.
/tmp/NuKeeper/c40c2eb6aaa746038d80b150d713d6ab/Watchman.Engine/Watchman.Engine.csproj : error NU1605:  Watchman.Engine -> Watchman.AwsResources -> AWSSDK.Core (>= 3.3.24.3)
/tmp/NuKeeper/c40c2eb6aaa746038d80b150d713d6ab/Watchman.Engine/Watchman.Engine.csproj : error NU1605:  Watchman.Engine -> AWSSDK.Core (>= 3.3.22.5)
  Generating MSBuild file /tmp/NuKeeper/c40c2eb6aaa746038d80b150d713d6ab/Watchman.Engine/obj/Watchman.Engine.csproj.nuget.g.props.
  Generating MSBuild file /tmp/NuKeeper/c40c2eb6aaa746038d80b150d713d6ab/Watchman.Engine/obj/Watchman.Engine.csproj.nuget.g.targets.
  Restore failed in 102.21 ms for /tmp/NuKeeper/c40c2eb6aaa746038d80b150d713d6ab/Watchman.Engine/Watchman.Engine.csproj.
```
@skolima
Copy link
Collaborator

skolima commented Jul 16, 2018

This looks to me as a subset of #128 . If we'd detect packages that have to be updated together (most likely by extending the graph walking feature to check constraints on the updates generated), we could solve this one.

@AnthonySteele
Copy link
Member Author

AnthonySteele commented Jul 16, 2018

It's definitely an ordering or a batching problem. Also it looks like it could be a warning (on a transitional state) which is promoted to an error by project settings

@AnthonySteele
Copy link
Member Author

I'm seeing similar today:

  Restoring packages for C:\Code\AwsWatchman\Quartermaster\Quartermaster.csproj...
  Restoring packages for C:\Code\AwsWatchman\Quartermaster.Tests\Quartermaster.Tests.csproj...
  Restoring packages for C:\Code\AwsWatchman\Watchman.Engine\Watchman.Engine.csproj...
  Restoring packages for C:\Code\AwsWatchman\Watchman.AwsResources\Watchman.AwsResources.csproj...
  Restoring packages for C:\Code\AwsWatchman\Watchman.Configuration\Watchman.Configuration.csproj...
  Restore completed in 222.38 ms for C:\Code\AwsWatchman\Watchman.Configuration\Watchman.Configuration.csproj.
  Restore completed in 363.31 ms for C:\Code\AwsWatchman\Watchman.Engine\Watchman.Engine.csproj.
  Restore completed in 367.44 ms for C:\Code\AwsWatchman\Watchman.AwsResources\Watchman.AwsResources.csproj.
  Restore completed in 367.48 ms for C:\Code\AwsWatchman\Quartermaster\Quartermaster.csproj.
C:\Code\AwsWatchman\Quartermaster.Tests\Quartermaster.Tests.csproj : error NU1605: Detected package downgrade: StructureMap from 4.7.0 to 4.6.1. Reference the package directly from the project to select a different version. 
C:\Code\AwsWatchman\Quartermaster.Tests\Quartermaster.Tests.csproj : error NU1605:  Quartermaster.Tests -> Quartermaster -> StructureMap (>= 4.7.0) 
C:\Code\AwsWatchman\Quartermaster.Tests\Quartermaster.Tests.csproj : error NU1605:  Quartermaster.Tests -> StructureMap (>= 4.6.1)
  Restore failed in 475.32 ms for C:\Code\AwsWatchman\Quartermaster.Tests\Quartermaster.Tests.csproj.

So NuKeeper is updating StructureMap from 4.6.1 to 4.7.0 in all projects. Ordering seems to be an issue - this test project which references other projects in the solution is updated later and this causes issues.

@AnthonySteele
Copy link
Member Author

AnthonySteele commented Aug 7, 2018

If I am reading this issue right, what is happening is that you have Quartermaster.csproj and Quartermaster.Tests.csproj using StructureMap 4.6.1. Quartermaster.Tests also references Quartermaster of course.

Now the update to StructureMap 4.70 is applied. As it happens, Quartermaster comes first. But afterwards, Quartermaster.Tests must both use StructureMap 4.6.1 from the local ref, and StructureMap 4.70 or later from the Quartermaster reference. The build system does not like this, so the process aborts.

The end state is consistent, but the intermediate state is not.

Applying the update to the "direct reference" in Quartermaster.Tests first would be fine. In general, projects would be ordered like the topological sort according to which projects refer to which other projects, but with leaves first this time.

Unless there's a way now to ask dotnet to do a solution-wide package update and it can manage the project ordering?

https://docs.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu1605

@AnthonySteele
Copy link
Member Author

AnthonySteele commented Aug 16, 2018

I have been thinking about this one. In order to sort projects, we need to relate them.

When we have a new style VS 2018 project, we are parsing the .csproj file (or equivalently a .vbproj etc) already, so collecting the ProjectReference nodes out of it and attaching them to the package updates isn't a big change.

However if we have an old-style project, we are parsing the packages.config file and haven't even matched a corresponding .csproj file (which is also, parsed I think, but since it contains no package refs, to no outcome).

This was referenced Aug 19, 2018
@AnthonySteele
Copy link
Member Author

Should be fixed in 0.6.4 but this will become clear in the next week.

@fgs-dbudwin
Copy link

I just updated from 0.6.2 to 0.6.4 because I was having this exact issues with dependencies between MyProject.Tests and MyProject sharing a dependency. 0.6.4 appears to have fixed this issue and NuKeeper worked as expected!

Side note: This is an excellent project, and we really love using this on our team in a nightly Jenkins job to update a single dependency each night--really helps us stay on top of things.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants