Skip to content

.NET SDK & NuGet.Commandline.Xplat integration should be compile time and not runtime #13089

Open
0 of 1 issue completed

Description

@nkolev92

When commands like dotnet nuget push or dotnet nuget config, dotnet list package today are invoked, the .NET SDK's dotnet.exe process has it's own parsing, which later gets forwarded to a completely new runnable, NuGet.Commandline.Xplat, which pretty much duplicates all the arguments.

This leads to an unnecessary 2nd process, difficulty debugging, + lots of duplicate work.

The proposal here is to change this integration to a compile time one, where the SDK just calls methods of NuGet.Commandline.Xplat instead of shelling out to a completely new process.

Sub-issues

Sub-issues

0 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. nkolev92 commented on Dec 14, 2023

    @nkolev92
    MemberAuthor
  2. changed the title [-].NET SDK & NuGet.Commandline.Xplat integration should be compile/not runtime[/-] [+].NET SDK & NuGet.Commandline.Xplat integration should be compile time and not runtime[/+] on Dec 14, 2023
  3. baronfel commented on Dec 14, 2023

    @baronfel

    Love it :) The Template Engine used to have an integration like this before that integration moved completely into the SDK repo. The way it used to work is that the engine would ship a System.CommandLine.CliCommand-factory function and the SDK CLI would gather the dependencies for that factory, inject them, and then mount the CliCommand in its own grammar. This worked fairly well, but we had to keep on top of a few pain points:

    • common options/standards in CLI UX - things like option names and aliases
    • versions of System.CommandLine - since it is still in beta and making breaking changes, any updates to the S.CL library in one component could require orchestration across the other components. we still have that problem today (in fact Yanni just got done with the latest multi-repo sync).

    but from an actual usability perspective it went pretty well! Alternatively, if NuGet wanted to move more of the CLI implementation of your commands into the SDK repo, we would likely also be happy to do that - with NuGet remaining primary owners of that particular 'slice' of the SDK.

  4. nkolev92 commented on Dec 14, 2023

    @nkolev92
    MemberAuthor

    Normally I'd say fewer repos we have to maintain the better, so my thought was the implementation stays here, since we have a lot of test helper code that I wouldn't want to copy on the SDK side. I hadn't considered the CLI command factory, that's actually probably the best long term thing, especially S.CL goes stable.

    My original thinking was currently the SDK implementation does parsing and just flat out forwarding. Instead of that, the SDK could call a runner on our side with a type defined by NuGet.

    That'd still be more manual, but it allows us to ignore the S.CL concerns.

    My primary motivation was to get rid of the 2 process thing!

  5. added
    Priority:2
    on Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Partner:CLI-SDKPriority:2Product:dotnet.exeTechDebtType:DCR

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions