NuGet lock files
How to enable lock files for .NET NuGet packages
This is mainly for my benefit (and to be honest, a fair bit of what I post here is just as much for me as it is for anyone else!)
To enable NuGet lock files, add a Directory.Build.props
file (with that exact case) to your project. Usually in the root directory of your code repo, or in the specific project directories if you don’t want all .NET projects to inherit this.
Add this content to the file (or just copy the RestorePackagesWithLockFile
property into an existing PropertyGroup
if the file already exists)
<Project>
<PropertyGroup>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
</PropertyGroup>
</Project>
References:
Also worth mentioning as an update to my post back in 2021 about Dependabot and NuGet lockfiles that Dependabot finally supports updating NuGet lockfiles (as of September last year)