AutomationIoC.CommandLine 3.0.0-beta1

This is a prerelease version of AutomationIoC.CommandLine.
dotnet add package AutomationIoC.CommandLine --version 3.0.0-beta1
                    
NuGet\Install-Package AutomationIoC.CommandLine -Version 3.0.0-beta1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AutomationIoC.CommandLine" Version="3.0.0-beta1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AutomationIoC.CommandLine" Version="3.0.0-beta1" />
                    
Directory.Packages.props
<PackageReference Include="AutomationIoC.CommandLine" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AutomationIoC.CommandLine --version 3.0.0-beta1
                    
#r "nuget: AutomationIoC.CommandLine, 3.0.0-beta1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AutomationIoC.CommandLine@3.0.0-beta1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AutomationIoC.CommandLine&version=3.0.0-beta1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=AutomationIoC.CommandLine&version=3.0.0-beta1&prerelease
                    
Install as a Cake Tool

Nuget Version Nuget Downloads Continuous Integration

AutomationIoC.Runtime

Dependency Injection Framework for C# Console Applications

NuGet Packages

Package Description
AutomationIoC.CommandLine Dependency Injection Framework for C# Console Applications

Documentation

Please visit the AutomationIoC Documentation Site for installation, getting started, and API documentation.

Samples

Please visit and/or download our AutomationIoC.CommandLine Sample Solution to get a more in-depth view of usage.

Installation

.NET CLI


dotnet add package AutomationIoC.CommandLine

Development

Create Automation Console Command to run

public class TestCommand : IAutomationCommand
{
    public void Initialize(AutomationCommand command)
    {
        Option<string> configurationKeyOption = new(name: "--key")
        {
            Description = "Name of key to pull from configuration."
        };

        command.Options.Add(configurationKeyOption);

        command.SetAction(async (parseResult, context, cancellationToken) =>
        {
            string configurationKey = parseResult.GetValue(configurationKeyOption);

            IServiceProvider serviceProvider = context.ServiceProvider;

            TestConfigurationService testConfigurationService =
                serviceProvider.GetRequiredService<TestConfigurationService>();

            string configurationValue =
                await testConfigurationService
                    .GetConfigurationValueAsync(configurationKey, cancellationToken)
                    .ConfigureAwait(false);

            Console.WriteLine($"Configuration Value Requested: {configurationValue}");
        });
    }
}

// Sample test configuration service to retrieve configuration values
public class TestConfigurationService(IConfiguration configuration)
{
    public string GetConfigurationValue(string key) =>
        configuration.GetValue<string>(key) ?? throw new KeyNotFoundException($"Configuration key '{key}' not found.");

    public Task<string> GetConfigurationValueAsync(string key, CancellationToken cancellationToken = default) =>
        Task.FromResult(GetConfigurationValue(key));
}

Add Automation Console Builder in startup

class Program
{
    static void Main(string[] args)
    {
        IAutomationConsoleBuilder builder =
            // Passing in "args" is optional
            AutomationConsole.CreateDefaultBuilder(args)
                // Add command name/path here
                .AddCommand<TestCommand>("check-config")
                // Build IConfiguration
                .Configure((context, configurationBuilder) =>
                {
                    var appSettings = new Dictionary<string, string>
                    {
                        {
                            "MyConfigurationKey", Guid.NewGuid().ToString()
                        }
                    };
                    configurationBuilder.AddInMemoryCollection(appSettings);
                })
                // Register services
                .ConfigureServices((context, services) =>
                {
                    services.AddTransient<TestConfigurationService>();
                });

        IAutomationConsole console = builder.Build();

        console.Run();
    }
}

Run command

dotnet run -- check-config --key MyConfigurationKey

Other Resources

Package Description
AutomationIoC.Runtime Runtime services for AutomationIoC framework
AutomationIoC.PowerShell PowerShell PSCmdlet SDK utilities for Automation framework development
AutomationIoC.PowerShell.Tools Development tools for running/testing PSCmdlets built with Automation framework
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0-beta1 92 7/31/2025
3.0.0-alpha2 262 7/26/2025
3.0.0-alpha1 340 7/25/2025