fsprojects / fsprojects/Paket

'paket add --interactive' does not do interactive adding

Open
#4,117 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
F#
Stars
2.1k
Forks
528
Avg merge
1d 12m
Merged PRs (30d)
54

Description

Description

(Tested in 4.8, net5.0, net6.0)

Using paket add --interactive doesn't do what it should; instead of adding the specified package interactively, it justs adds the package to the first found project.

add --interactive is my goto command for adding a package to multiple/all projects in a large solution.

Repro steps
mkdir paket-add-repro
cd paket-add-repro

dotnet new sln -n repro
dotnet new console -f net5.0 -n proj1
dotnet new classlib -f net5.0 -n proj2
dotnet sln add proj1
dotnet sln add proj2

dotnet new tool-manifest
dotnet tool install paket
dotnet tool restore

dotnet paket init
dotnet paket add Newtonsoft.Json --interactive
dotnet paket install
dotnet paket find-refs Newtonsoft.Json
Expected behavior

For every found project, Paket asks me if I want to add the specified reference to it.

Actual behavior

Paket adds the package to the first found project. Note that it also does this without the --interactive flag, which is not what the docs say it should do:

By default packages are only added to the solution directory, but not on any of its projects. It's possible to add the package to a specific project

Last bit of console output:

C:\dev\paket-add-repro>dotnet paket add Newtonsoft.Json --interactive
Paket version 6.2.1+c82f25d6c324024cbd231df154a447a117c2546e
Adding package 'Newtonsoft.Json'
Resolving dependency graph...
Created dependency graph (1 packages in total)
Resolved package 'Newtonsoft.Json' to version 13.0.1
Total time taken: 923 milliseconds

C:\dev\paket-add-repro>dotnet paket install
Paket version 6.2.1+c82f25d6c324024cbd231df154a447a117c2546e
Skipping resolver for group Main since it is already up-to-date
Installing into projects:
Created dependency graph (1 packages in total)
Total time taken: 0 milliseconds

C:\dev\paket-add-repro>dotnet paket find-refs Newtonsoft.Json
Paket version 6.2.1+c82f25d6c324024cbd231df154a447a117c2546e
Main Newtonsoft.Json
C:\dev\paket-add-repro\proj1\proj1.csproj

Total time taken: 0 milliseconds
Known workarounds

E.g: Powershell: (Get-ChildItem -Filter *.*sproj -Recurse).FullName | Sort length -Descending | Foreach {.\.paket\paket.exe add System.Diagnostics.DiagnosticSource --project $_}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the behavior with the provided dotnet paket init, paket add Newtonsoft.Json --interactive, and paket find-refs commands, then trace the paket add --interactive command entry point. Done means the command prompts for each discovered project and does not silently add the package only to the first project; verify both interactive and non-interactive behavior against the documented expectations.

Written by the indexing model from the issue text.

Assessment

Tech stack
fsharp
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.