-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Enable using package lock files for NuGet restore #12654
Conversation
I also enabled |
Could we simply add a |
I think we would lose the certainty by having some projects having undeterministic dependencies. Of course, separating delivered projects from test/support would make sense. Might be easier with targeted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I sincerely apologize for us taking so much time here. I checked out the PR, going over old ones, and this would be quite useful.
Is this something you'd like to revisit any time soon or should we close? This would need to be updated with the latest main
.
When addressing review feedback, please adhere to the following:
- Apply code suggestions directly so the reviewer doesn't have to eyeball the changes. These resolve themselves after applying them, that's fine.
- Don't resolve other conversations so it's easier to track for the reviewer. Then, the reviewer will resolve them.
- Feel free to mark conversations that you addressed to keep track of them with an emoji or otherwise, just don't resolve them.
- Please keep conversations happening in line comment in those convos, otherwise communication will be a mess. If you have trouble finding them, see this video.
- Please click "Re-request review" in the top-right corner for each reviewer when you're ready for another round of review, so they know that you're done.
@@ -17,6 +17,10 @@ | |||
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> | |||
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> | |||
|
|||
<EnableLockFiles Condition="$(MSBuildProjectDirectory.Contains('.Tests.')) == false and $(MSBuildProjectDirectory.Contains('.Targets')) == false">true</EnableLockFiles> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use lock files for these projects?
<RestorePackagesWithLockFile Condition="$(EnableLockFiles) == 'true'">true</RestorePackagesWithLockFile> | ||
<RestoreLockedMode Condition="$(EnableLockFiles) == 'true' and '$(ContinuousIntegrationBuild)' == 'true'">true</RestoreLockedMode> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Link to some docs about both of these properties, please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these files automatically managed during a NuGet version update when one updates packages locally in the solution or is there anything special to be done? If the latter, please add docs about it to Dependencies.props
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I understand correctly that these can't be DRYd anymore, not to have hundreds of files?
FWIW, most of the projects I've worked on that were using lock files have stopped using them:
IMHO, the very few advantages it offers are not enough to justify the EXTREME noise it generates (not to mention the very high risk of merge conflicts in PRs, specially here with our "one PR per dependency change" policy). |
@kevinchalet makes excellent points above so I'm closing this. Maybe better in enterprise setting where we also generate license information reports which are tightly tied to versions. |
That's a good perspective! My concern that this fixes is mostly about our dependencies using floating versions. E.g. we use |
This is not the behavior you should be seeing: NuGet always enforces a "lowest version possible" policy by default (and AFAICT, OrchardCore doesn't opt in a different So when referencing |
Here's the complete list of dependencies - transitive packages included - I'm getting for
|
Ah OK, good, thank you. |
Originally found this while testing #12589 .
While the current dependencies file states desired versions, it could resolve to different dependency graphs (versions) depending on when restore is done. By enabling repeatable package restores, builds should be locked to given versions and also allow unambiguous caching of NuGet references.
With this PR, proposing to enable lock file usage by default and committing lock files to VCS, just like it's done for Node dependencies.