Giter VIP home page Giter VIP logo

locked-mode-restore-repro's Introduction

Description

There seems to be an issue using git CPVM and package locks.

Repo description

the repo consists of 2 projects:

  • proj-a - a net472 console project, with dependency on 3 packages (centrally managed) and a project reference on proj-b
  • proj-b - a netstandard2.0 library, with dependency on 2 packages (centrally managed, mutually exclusive to proj-a dependencies) with no project references.

for both project CVPM is enabled and both project create package locks (RestorePackagesWithLockFile is set to true)

Reproduce

dotnet restore --no-cache --force --force-evaluate
dotnet build --no-restore
dotnet run --no-build --project .\proj-a\proj-a.csproj

you should see an output:

[2020-11-16T21:30:09.5286941Z] - repro?!

meaning that while we do not try to restore using the package locks - the code is restoring and working.

However, attempting to restore in locked mode:

dotnet restore --no-cache --force --locked-mode

will result in an error:

Determining projects to restore...
C:\Program Files\dotnet\sdk\3.1.404\NuGet.targets(128,5): error NU1004: The packages lock file is inconsistent with the project dependencies so restore can't be 
run in locked mode. Disable the RestoreLockedMode MSBuild property or pass an explicit --force-evaluate option to run restore to update the lock file. [D:\code\lock-sln\lock-sln.sln]
  Failed to restore D:\code\lock-sln\proj-a\proj-a.csproj (in 99 ms).
  Restored D:\code\lock-sln\proj-b\proj-b.csproj (in 359 ms).

Suspected error

If we carefully examin the package lock file created for proj-a we will see an errornous listing of dependencies for the referenced proj-b project:

"proj-b": {
  "type": "Project",
  "dependencies": {
    "Newtonsoft.Json": "12.0.3",
    "Newtonsoft.Json.Schema": "3.0.13",
    "TaskTupleAwaiter": "[1.2.0, 2.0.0)",
    "UrlBase64": "0.1.2",
    "ZooKeeperNetEx": "3.4.12.4"
  }
}

However, we only take dependency on UrlBase64 and ZooKeeperNetEx in the csproj for proj-b. If we manually delete:

    "Newtonsoft.Json": "12.0.3",
    "Newtonsoft.Json.Schema": "3.0.13",
    "TaskTupleAwaiter": "[1.2.0, 2.0.0)",

The restore command in locked mode will succeed.

References

NuGet/Home#10074

locked-mode-restore-repro's People

Contributors

eugenekrapivin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.