Paket
Paket copied to clipboard
'paket add --interactive' does not do interactive adding
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 $_}