dotnet / command-line-api

Command line parsing, invocation, and rendering of terminal output.
https://github.com/dotnet/command-line-api/wiki
MIT License
3.41k stars 382 forks source link

Type or namespace name 'CliCommand' not found. #2485

Open johnholliday opened 2 months ago

johnholliday commented 2 months ago

Simple application fails to resolve.

Program.cs

using System.CommandLine;

public class SampleCommand : CliCommand // <-- CS0246
{

}

TestProgram.csproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
    <PackageReference Include="System.CommandLine.NamingConventionBinder" Version="2.0.0-beta4.22272.1" />
  </ItemGroup>

</Project>
NeverMorewd commented 2 months ago

Is there any workaround?

KalleOlaviNiemitalo commented 2 months ago

2.0.0-beta4.22272.1 is two years old. In that version, the class is named System.CommandLine.Command: https://github.com/dotnet/command-line-api/blob/209b724a3c843253d3071e8348c353b297b0b8b5/src/System.CommandLine/Command.cs#L21

NeverMorewd commented 2 months ago

Add a nuget source and update the nuget version to 2.0.0-beta4.24324.3 Daily builds are available if you add this feed to your nuget.config: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-libraries/nuget/v3/index.json

KalleOlaviNiemitalo commented 2 months ago

If you have an application using System.CommandLine 2.0.0-beta4.22272.1 and you upgrade to 2.0.0-beta4.24324.3 from that dnceng feed, you need to adapt the app to breaking changes in the API… and then there'll be more API breaks if the main-powderhouse branch is eventually merged and released.

I haven't seen any promises about how long the https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-libraries/nuget/v3/index.json feed will exist. If I used packages from that in production, I'd make sure to archive them locally, so as to keep old versions of my app buildable even if the feed is deleted in the future.

N7K4 commented 1 month ago

Where can I find the current / latest documentation from. I updated from 2.0.0-beta4.22272.1 to 2.0.0-beta4.24324.3 . But there are a lot of changes, even breaking ones. But the docu is still on 2022 or 2023. Even there is no "hello-world" cli working example, with the newer versions of the CLI nuget package.

Developers are lost in the early beginning ...

Balkoth commented 1 month ago

There is no documentation for the latest betas. It would be a waste of time anyway as the PowderHouse will completely change once again.

KalleOlaviNiemitalo commented 1 month ago

Up-to-date documentation for the main and main-powderhouse branches is not published.

@N7K4, if you are making a commercial product, I don't recommend using System.CommandLine in its current state, when there are only preview releases. Better use a different package or write your own parser.

If you're instead hacking on a hobby project, then I suppose you can use DocFX to generate API reference documentation in HTML. Concept documentation and examples would be missing though, so you'd have to spend time perusing the implementation.