CliInvoke.Specializations 2.0.1

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package CliInvoke.Specializations --version 2.0.1
                    
NuGet\Install-Package CliInvoke.Specializations -Version 2.0.1
                    
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="CliInvoke.Specializations" Version="2.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CliInvoke.Specializations" Version="2.0.1" />
                    
Directory.Packages.props
<PackageReference Include="CliInvoke.Specializations" />
                    
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 CliInvoke.Specializations --version 2.0.1
                    
#r "nuget: CliInvoke.Specializations, 2.0.1"
                    
#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 CliInvoke.Specializations@2.0.1
                    
#: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=CliInvoke.Specializations&version=2.0.1
                    
Install as a Cake Addin
#tool nuget:?package=CliInvoke.Specializations&version=2.0.1
                    
Install as a Cake Tool

CliInvoke.Specializations

This readme covers the CliInvoke Specializations library.

Looking for the CliInvoke Readme?

Latest NuGet Latest Pre-release NuGet Downloads License

Usage

CliInvoke.Specializations comes with three specializations as of 1.0.0:

  • CmdProcessConfiguration — An easier way to execute processes and commands through cmd.exe (Only supported on Windows)
  • ClassicPowershellProcessConfiguration — An easier way to execute processes and commands through Windows PowerShell (Only supported on Windows)
  • PowershellProcessConfiguration — An easier way to execute processes and commands through the modern Cross-Platform open source PowerShell (PowerShell is not installed by CliInvoke and is expected to be installed if you plan to use it.)

All Command specialization classes come with an already configured TargetFilePath that points to the relevant executable.

CmdProcessConfiguration

The CmdProcessConfiguration TargetFilePath points to Windows' copy of cmd.exe. This is only supported on Windows.

using AlastairLundy.CliInvoke.Core;
using AlastairLundy.CliInvoke.Builders;
using AlastairLundy.CliInvoke.Core.Builders;
using AlastairLundy.CliInvoke.Core.Extensibility.Factories;

using AlastairLundy.CliInvoke.Specializations.Configurations;
using AlastairLundy.CliInvoke.Specializations;

    // ServiceProvider and Dependency Injection code ommitted for clarity
    
    IProcessInvoker _processInvoker = serviceProvider.GetRequiredService<IProcessInvoker>();
  IRunnerProcessFactory _runnerProcessFactory = serviceProvider.GetRequiredService<IRunnerProcessFactory>();
  
  //Create your runner configuration.
         ProcessConfiguration runnerConfig = new CmdProcessConfiguration("Your arguments go here",
                    // Set standard input, output, and error
          false, true, true, Environment.SystemDirectory);
  
  // Create your configuration to be run.
  ProcessConfiguration config = new ProcessConfiguration("Path/To/Exe",
  false, true, true, "With/Arguments")
  
  // Creates a ProcessConfiguration that will use the runner configuration to run the desired configuration.
  ProcessConfiguration processToRun = _runnerProcessFactory.CreateRunnerConfiguration(config, runnerConfig);
  
  BufferedProcessResult result = await _processInvoker.ExecuteBufferedAsync(processToRun);

If the result of the command being run is not of concern you can call ExecuteAsync() instead of ExecuteBufferedAsync() and ignore the returned ProcessResult like so:

using AlastairLundy.CliInvoke.Core;
using AlastairLundy.CliInvoke.Builders;
using AlastairLundy.CliInvoke.Core.Builders;
using AlastairLundy.CliInvoke.Core.Extensibility.Factories;

using AlastairLundy.CliInvoke.Specializations.Configurations;
using AlastairLundy.CliInvoke.Specializations;

    // ServiceProvider and Dependency Injection code ommitted for clarity
    
    IProcessInvoker _processInvoker = serviceProvider.GetRequiredService<IProcessInvoker>();
  IRunnerProcessFactory _runnerProcessFactory = serviceProvider.GetRequiredService<IRunnerProcessFactory>();
  
  //Create your runner configuration.
         ProcessConfiguration runnerConfig = new CmdProcessConfiguration("Your arguments go here",
                    // Set standard input, output, and error
          false, true, true, Environment.SystemDirectory);
  
  // Create your configuration to be run.
  ProcessConfiguration config = new ProcessConfiguration("Path/To/Exe",
  false, true, true, "With/Arguments")
  
  // Creates a ProcessConfiguration that will use the runner configuration to run the desired configuration.
  ProcessConfiguration processToRun = _runnerProcessFactory.CreateRunnerConfiguration(config, runnerConfig);
  
  ProcessResult result = await _processInvoker.ExecuteAsync(processToRun);

ClassicPowershellProcessConfiguration

The ClassicPowershellCommand is a specialized Command class with an already configured TargetFilePath that points to Windows' copy of powershell.exe.

This is only supported on Windows.

using AlastairLundy.CliInvoke.Core;
using AlastairLundy.CliInvoke.Builders;
using AlastairLundy.CliInvoke.Core.Builders;
using AlastairLundy.CliInvoke.Core.Extensibility.Factories;

using AlastairLundy.CliInvoke.Specializations.Configurations;
using AlastairLundy.CliInvoke.Specializations;

    // ServiceProvider and Dependency Injection code ommitted for clarity
    
    IProcessInvoker _processInvoker = serviceProvider.GetRequiredService<IProcessInvoker>();
  IRunnerProcessFactory _runnerProcessFactory = serviceProvider.GetRequiredService<IRunnerProcessFactory>();
  
  //Create your runner configuration.
         ProcessConfiguration runnerConfig = new CmdProcessConfiguration("Your arguments go here",
                    // Set standard input, output, and error
          false, true, true, Environment.SystemDirectory);
  
  // Create your configuration to be run.
  ProcessConfiguration config = new ProcessConfiguration("Path/To/Exe",
  false, true, true, "With/Arguments")
  
  // Creates a ProcessConfiguration that will use the runner configuration to run the desired configuration.
  ProcessConfiguration processToRun = _runnerProcessFactory.CreateRunnerConfiguration(config, runnerConfig);
  
  BufferedProcessResult result = await _processInvoker.ExecuteBufferedAsync(processToRun);

PowershellProcessConfiguration

The PowershellProcessConfiguration's TargetFilePath points to the installed copy of cross-platform PowerShell if it is installed.

This is only supported on platforms that cross-platform PowerShell supports.

using AlastairLundy.CliInvoke.Core;
using AlastairLundy.CliInvoke.Builders;
using AlastairLundy.CliInvoke.Core.Builders;
using AlastairLundy.CliInvoke.Core.Extensibility.Factories;

using AlastairLundy.CliInvoke.Specializations.Configurations;
using AlastairLundy.CliInvoke.Specializations;

    // ServiceProvider and Dependency Injection code ommitted for clarity
    
    IProcessInvoker _processInvoker = serviceProvider.GetRequiredService<IProcessInvoker>();
  IRunnerProcessFactory _runnerProcessFactory = serviceProvider.GetRequiredService<IRunnerProcessFactory>();
  
  //Create your runner configuration.
         ProcessConfiguration runnerConfig = new CmdProcessConfiguration("Your arguments go here",
                    // Set standard input, output, and error
          false, true, true, Environment.SystemDirectory);
  
  // Create your configuration to be run.
  ProcessConfiguration config = new ProcessConfiguration("Path/To/Exe",
  false, true, true, "With/Arguments")
  
  // Creates a ProcessConfiguration that will use the runner configuration to run the desired configuration.
  ProcessConfiguration processToRun = _runnerProcessFactory.CreateRunnerConfiguration(config, runnerConfig);
  
  BufferedProcessResult result = await _processInvoker.ExecuteBufferedAsync(processToRun);

Licensing

CliInvoke and CliInvoke Specializations are licensed under the MPL 2.0 license.

If you use CliInvoke or CliInvoke.Specializations in your project, please make an exact copy of CliInvoke's LICENSE.txt file available either in your third party licenses txt file or as a separate txt file.

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 netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  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
2.4.0-alpha.1 41 1/23/2026
2.3.1 84 2/4/2026
2.3.0 90 1/23/2026
2.2.1 84 1/21/2026
2.2.0 107 12/29/2025
2.1.4 147 12/26/2025
2.1.2 421 12/11/2025
2.1.1 404 11/18/2025
2.1.0 188 11/15/2025
2.0.1 408 11/18/2025
2.0.0 240 11/14/2025

* Update internal Polyfill version from 8.9.1 to 9.1.0