Skip to content
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

Support for NuGet package lock files #1303

Open
xt0rted opened this issue Aug 9, 2019 · 22 comments · May be fixed by #9678
Open

Support for NuGet package lock files #1303

xt0rted opened this issue Aug 9, 2019 · 22 comments · May be fixed by #9678
Labels
F: language-support Issues specific to a particular language or ecosystem; may be paired with an L: label. Keep Exempt this from being marked by stalebot L: dotnet:nuget NuGet packages via nuget or dotnet T: feature-request Requests for new features

Comments

@xt0rted
Copy link

xt0rted commented Aug 9, 2019

In NuGet 4.9 I think it is they added support for package lock files using the setting RestorePackagesWithLockFile which is part of your .csproj or .props file chain. This creates a file called packages.lock.json alongside your project file. The spec for this can be found at https://github.com/NuGet/Home/wiki/Enable-repeatable-package-restore-using-lock-file

@greysteil
Copy link
Contributor

Super keen to do this, but it's going to require some work - at the moment Dependabot does all of its .NET updating in Ruby, and we'll need to change that. We might want to continue this over at #541?

@stale stale bot added the wontfix label Oct 23, 2019
@feelepxyz feelepxyz added the T: feature-request Requests for new features label Oct 23, 2019
@stale stale bot removed the wontfix label Oct 23, 2019
gitfool added a commit to gitfool/Cake.Dungeon that referenced this issue Nov 24, 2019
Breaks Dependabot PRs until lock files supported (dependabot/dependabot-core#1303).
@gitfool
Copy link

gitfool commented Feb 19, 2020

@jerriep. given your great work with dotnet-outdated, do you have any advice on how Dependabot can also update any associated dependency lock files in its PR?

Is the best way to run dotnet restore, perhaps with --force-evaluate, or are there other better ways?

@jerriep
Copy link

jerriep commented Feb 20, 2020

@gitfool No, I was not even aware of this new feature until you just pointed it out. You may have to resort to using some of the NuGet Client libraries to achieve this.

Maybe look at this PR and the linked specifications to see whether there are some hints to guide you.

@infin8x infin8x mentioned this issue Jul 2, 2020
8 tasks
@infin8x infin8x added F: language-support Issues specific to a particular language or ecosystem; may be paired with an L: label. L: dotnet:nuget NuGet packages via nuget or dotnet labels Jul 20, 2020
SonicGD added a commit to sitkoru/Sitko.Core that referenced this issue Aug 6, 2020
@vmcbaptista
Copy link

is there any news regarding this topic?

@edumserrano
Copy link

Would also be interested in support for this feature. Any updates?

@majastrz
Copy link

Would also be interested in support for this.

@flcdrg
Copy link

flcdrg commented Sep 27, 2021

I've written up a workaround for this at https://david.gardiner.net.au/2021/05/dependabot-nuget-lockfiles.html, but would much prefer it was handled natively given that dependabot stops maintaining the PR once a 'foreign' commit has been added.

@ldeluigi
Copy link

ldeluigi commented Oct 7, 2021

Much needed feature!

@nogic1008
Copy link

As a workaround, I define a GitHub action in my repository that kicks dotnet restore.
Note: You need to use Personal Access Token to re-trigger another GitHub Actions (like unit testing)

  restore:
    name: Update NuGet Lock Files
    if: contains(github.head_ref, 'dependabot') && github.event_name == 'pull_request'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2.4.0
        with:
          ref: ${{ github.head_ref }}
          token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
      - uses: actions/setup-dotnet@v1.9.0
        with:
          dotnet-version: 6.0.x

      - run: dotnet restore --force-evaluate
      - id: diff
        continue-on-error: true
        run: |
          git add -N .
          git diff --name-only --exit-code
      - if: steps.diff.outcome == 'failure'
        run: |
          git config user.email "github-actions[bot]@users.noreply.github.com"
          git config user.name "github-actions[bot]"
          git add .
          git commit -m "chore(deps): update NuGet lock file"
          git push

0xced added a commit to serilog-contrib/serilog-formatting-log4net that referenced this issue Apr 7, 2022
Dependabot does not yet support automatically updating the lock file, see dependabot/dependabot-core#1303
0xced added a commit to serilog-contrib/serilog-formatting-log4net that referenced this issue May 24, 2022
Dependabot does not yet support automatically updating the lock file, see dependabot/dependabot-core#1303
0xced added a commit to serilog-contrib/serilog-formatting-log4net that referenced this issue Jun 29, 2022
Dependabot does not yet support automatically updating the lock file, see dependabot/dependabot-core#1303
0xced added a commit to serilog-contrib/serilog-formatting-log4net that referenced this issue Aug 31, 2022
Dependabot does not yet support automatically updating the lock file, see dependabot/dependabot-core#1303
@anthony-c-martin
Copy link

@greysteil - do you have any technical pointers to share on what a solution would look like? I'd be happy to contribute a fix if there's a clear path forward.

@gitfool
Copy link

gitfool commented Nov 2, 2022

You could look at what Renovate does since it already handles package lock files:
https://github.com/renovatebot/renovate/blob/b6670159c4c6c3e6e1b07829604b2c3301f54162/lib/modules/manager/nuget/artifacts.ts#L98
(Or just switch to Renovate.)

@greysteil
Copy link
Contributor

@greysteil - do you have any technical pointers to share on what a solution would look like? I'd be happy to contribute a fix if there's a clear path forward.

I'm not the right person to ask anymore (I'm a PM working across all of GitHub's security products these days, and no longer an expert on Dependabot). @jeffwidman @deivid-rodriguez do either of you have pointers here?

@anthony-c-martin
Copy link

Thanks! I've hacked my way through an implementation (PR #6031). @jeffwidman / @deivid-rodriguez - would appreciate some guidance if you've got the time!

@josesimoes
Copy link

👍🏻 for having this. We've recently added packages.lock file to .NET nanoFramework libraries and tools and now each update from dependabot fails to build because the packages.lock file is not updated along.

Here's the most recent PR failing on the pipeline build: nanoframework/nanoFirmwareFlasher#174

networkfusion added a commit to nanoframework/nanoFrameworkDeployer that referenced this issue Dec 8, 2022
@milkshakeuk
Copy link

Thanks! I've hacked my way through an implementation (PR #6031). @jeffwidman / @deivid-rodriguez - would appreciate some guidance if you've got the time!

Any updates @jeffwidman @deivid-rodriguez ?

@deivid-rodriguez
Copy link
Contributor

Hei, nice! We love lockfiles around here :)

Both @jeffwidman and I are going through the backlog of PRs, so we should eventually get to this. I personally know nothing about nuget so I will need to read on a few things to properly review that PR. On top of that, I first want to get merged a bunch of other PR I haven't yet got to merging. But I'll get to this one soonish unless Jeff beats me to it!

@ldeluigi
Copy link

Hei, nice! We love lockfiles around here :)

Both @jeffwidman and I are going through the backlog of PRs, so we should eventually get to this. I personally know nothing about nuget so I will need to read on a few things to properly review that PR. On top of that, I first want to get merged a bunch of other PR I haven't yet got to merging. But I'll get to this one soonish unless Jeff beats me to it!

I'm glad to read this!

@dependabot dependabot deleted a comment from stale bot Jan 20, 2023
0xced added a commit to serilog-contrib/serilog-formatting-log4net that referenced this issue Feb 1, 2023
Dependabot does not yet support automatically updating the lock file, see dependabot/dependabot-core#1303
@Porges
Copy link

Porges commented Apr 4, 2023

The lack of support for Nuget lockfiles also extends to the dependency graph functionality and vulnerability analysis. Transitive dependencies are not detected even when they have critical vulnerabilities listed against them...

@jeffwidman
Copy link
Member

👋 Sorry for the delay.

I reviewed #6031, which would add support for NuGet package lock files to :dependabot: and the PR itself looked very straightforward / solid, but I had a couple of questions about general NuGet things. Since I haven't yet gotten a reply from the PR author, can anyone here pop by that PR and provide answers?

Be great to move this forward!

CaringDev added a commit to bbvch/LambdaTale that referenced this issue Aug 19, 2023
[dependabot does not support packages.lock.json](dependabot/dependabot-core#1303)
CaringDev added a commit to bbvch/LambdaTale that referenced this issue Aug 19, 2023
[dependabot does not support packages.lock.json](dependabot/dependabot-core#1303)
@sowa705
Copy link

sowa705 commented Jan 16, 2024

Hello, what is the status of this issue?

@jonjanego jonjanego added the Keep Exempt this from being marked by stalebot label Mar 14, 2024
SapiensAnatis added a commit to SapiensAnatis/Dawnshard that referenced this issue Mar 24, 2024
It's too annoying to enable builds using the lock file and have dependabot working, at least until dependabot can update this file by itself dependabot/dependabot-core#1303
SapiensAnatis added a commit to SapiensAnatis/Dawnshard that referenced this issue Mar 24, 2024
It's too annoying to enable builds using the lock file and have
dependabot working, at least until dependabot can update this file by
itself dependabot/dependabot-core#1303
@na1307
Copy link
Contributor

na1307 commented May 5, 2024

#6031 is too old. I tried to fix it, but I don't know where or how to fix it.

@trejjam
Copy link
Contributor

trejjam commented May 5, 2024

It should be relatively easy. You need to enable lock file generation in the https://github.com/dependabot/dependabot-core/tree/main/nuget/helpers/lib/NuGetUpdater which can actually cause issues with group updates.

Or since there is DotNet executable you can run DotNet restore after update before commit is finalized.

@na1307 na1307 linked a pull request May 6, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F: language-support Issues specific to a particular language or ecosystem; may be paired with an L: label. Keep Exempt this from being marked by stalebot L: dotnet:nuget NuGet packages via nuget or dotnet T: feature-request Requests for new features
Projects
None yet
Development

Successfully merging a pull request may close this issue.