CliInvoke.Specializations
2.3.0
Prefix Reserved
See the version list below for details.
dotnet add package CliInvoke.Specializations --version 2.3.0
NuGet\Install-Package CliInvoke.Specializations -Version 2.3.0
<PackageReference Include="CliInvoke.Specializations" Version="2.3.0" />
<PackageVersion Include="CliInvoke.Specializations" Version="2.3.0" />
<PackageReference Include="CliInvoke.Specializations" />
paket add CliInvoke.Specializations --version 2.3.0
#r "nuget: CliInvoke.Specializations, 2.3.0"
#:package CliInvoke.Specializations@2.3.0
#addin nuget:?package=CliInvoke.Specializations&version=2.3.0
#tool nuget:?package=CliInvoke.Specializations&version=2.3.0
CliInvoke.Specializations
This readme covers the CliInvoke Specializations library.
Looking for the CliInvoke Readme?
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 CliInvoke.Core;
using CliInvoke.Builders;
using CliInvoke.Core.Builders;
using CliInvoke.Core.Extensibility.Factories;
using CliInvoke.Specializations.Configurations;
using 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 CliInvoke.Core;
using CliInvoke.Builders;
using CliInvoke.Core.Builders;
using CliInvoke.Core.Extensibility.Factories;
using CliInvoke.Specializations.Configurations;
using 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 CliInvoke.Core;
using CliInvoke.Builders;
using CliInvoke.Core.Builders;
using CliInvoke.Core.Extensibility.Factories;
using CliInvoke.Specializations.Configurations;
using 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 CliInvoke.Core;
using CliInvoke.Builders;
using CliInvoke.Core.Builders;
using CliInvoke.Core.Extensibility.Factories;
using CliInvoke.Specializations.Configurations;
using 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 | Versions 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 is compatible. 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. |
-
.NETStandard 2.0
- CliInvoke.Core (>= 2.3.0)
-
net10.0
- CliInvoke.Core (>= 2.3.0)
-
net8.0
- CliInvoke.Core (>= 2.3.0)
-
net9.0
- CliInvoke.Core (>= 2.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
* Updated to use CliInvoke.Core 2.3.0