From 0df916b943796b5d439d1a0771c1ccba7aaec39e Mon Sep 17 00:00:00 2001 From: Kyle Burrows Date: Tue, 4 Nov 2025 19:55:37 -0500 Subject: [PATCH 1/2] fix bug where command wasn't getting registered when MapCommandName(options) was called --- .../CommandOptionsWriter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.CommandLine.Minimal.SourceGenerator/CommandOptionsWriter.cs b/src/System.CommandLine.Minimal.SourceGenerator/CommandOptionsWriter.cs index 070c177..20a84d0 100644 --- a/src/System.CommandLine.Minimal.SourceGenerator/CommandOptionsWriter.cs +++ b/src/System.CommandLine.Minimal.SourceGenerator/CommandOptionsWriter.cs @@ -47,7 +47,7 @@ public static class Configure{{binder.CommandNameTitleCase}}BuilderExtensions ); // do not add the class to services if it's static if (!binder.MethodIsStatic) - sb.AppendLine($" builder.Services.TryAddTransient<{binder.CommandOptionsName}>();"); + sb.AppendLine($" builder.Services.TryAddTransient<{binder.CommandNameTitleCase}>();"); sb.AppendLine( $$""" {{binder.CommandOptionsName}} cliOptions = builder.TryRegisterCommandOptions<{{binder.CommandOptionsName}}>(); From f20a5b100d00fade6fb702cced23aacf621e498d Mon Sep 17 00:00:00 2001 From: Kyle Burrows Date: Tue, 4 Nov 2025 20:02:10 -0500 Subject: [PATCH 2/2] used wrong property for class name --- .../CommandOptionsWriter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.CommandLine.Minimal.SourceGenerator/CommandOptionsWriter.cs b/src/System.CommandLine.Minimal.SourceGenerator/CommandOptionsWriter.cs index 20a84d0..d9e96a9 100644 --- a/src/System.CommandLine.Minimal.SourceGenerator/CommandOptionsWriter.cs +++ b/src/System.CommandLine.Minimal.SourceGenerator/CommandOptionsWriter.cs @@ -47,7 +47,7 @@ public static class Configure{{binder.CommandNameTitleCase}}BuilderExtensions ); // do not add the class to services if it's static if (!binder.MethodIsStatic) - sb.AppendLine($" builder.Services.TryAddTransient<{binder.CommandNameTitleCase}>();"); + sb.AppendLine($" builder.Services.TryAddTransient<{binder.FullClassName}>();"); sb.AppendLine( $$""" {{binder.CommandOptionsName}} cliOptions = builder.TryRegisterCommandOptions<{{binder.CommandOptionsName}}>();