-
Notifications
You must be signed in to change notification settings - Fork 252
Support dotnet add, update, remove pkg
https://github.com/NuGet/Home/issues/3751
Currently, there is no way of adding, update and removing package references in dotnet cli
Any one using dotnet cli.
The request comes from dotnet cli team that has initiated the process of adding a dotnet add|remove|update|list <type> <id>
command at https://github.com/dotnet/cli/issues/4521
We should add support for handling dotnet add|update|remove package <id>
where the type of reference is package reference.
- The Flow would be
dotnet add|update|remove package <id>
would invoke dotnet cli, which would pass the information to a NuGet.xplat api. - We will then use msbuild.construction api to perform the task.
dotnet add package <id> [--version|-v] [--framework|-f] [--no-restore|-n] [--source|-s] [--package-directory]
dotnet update package <id> [--version|-v] [--framework|-f] [--no-restore|-n]
dotnet remove package <id>
-
PreRelease Switch - We need a pre-release switch/flag from
dotnet ref
command. This would work the same way as the pre-release check box in the VS UI.
e.g. -dotnet add ref pkg Newtonsoft.Json -p|--prerelease
We have decided that we will not need this switch because -- Restore does not have a prerelease options.
- User can just specify x.y.z-* for prerelease packages.
-
Update sub verb - From NuGet's perspective an update ref sub-command makes sense.
e.g. -dotnet update package Newtonsoft.Json [-v|--version]
-
Empty Version String - The behavior when user does not specify an exact version should be consistent with other nuget operations.
e.g. -dotnet update ref pkg Newtonsoft.Json
-> Should be same as ->dotnet ref update Newtonsoft.Json -v|--version '*'
. But we write the resolved version in the csproj file. -
Multi-Targeting - We should have support for multi targeting.
Sr. No. | Project TFM | Package TFM | Sample Reference |
1 | netcoreapp1.0 and net46 | netcoreapp1.0 and net46 |
<ItemGroup> <PackageReference Include="NewtonSoft.Json"> <version>9.0.1</version> </PackageReference> </ItemGroup> |
2 | netcoreapp1.0 and net46 | netcoreapp1.0 |
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp1.0' "> <PackageReference Include="NewtonSoft.Json"> <version>9.0.1</version> </PackageReference> </ItemGroup> |
3 | netcoreapp1.0 | netcoreapp1.0 and net46 |
<ItemGroup> <PackageReference Include="NewtonSoft.Json"> <version>9.0.1</version> </PackageReference> </ItemGroup> |
-
Which API? - Microsoft.Build.Construction
-
Kick off restore after add/update ref? - In case a package ref is added or updated, VS kicks off a restore. Current answer is No.
-
Include private/public Assets? - This is not done at any platform i.e. nuget.exe/VS etc. Current answer is No.
Check out the proposals in the accepted
& proposed
folders on the repository, and active PRs for proposals being discussed today.