AlastairLundy.CliInvoke.Specializations
2.0.0-alpha.7
Prefix Reserved
See the version list below for details.
dotnet add package AlastairLundy.CliInvoke.Specializations --version 2.0.0-alpha.7
NuGet\Install-Package AlastairLundy.CliInvoke.Specializations -Version 2.0.0-alpha.7
<PackageReference Include="AlastairLundy.CliInvoke.Specializations" Version="2.0.0-alpha.7" />
<PackageVersion Include="AlastairLundy.CliInvoke.Specializations" Version="2.0.0-alpha.7" />
<PackageReference Include="AlastairLundy.CliInvoke.Specializations" />
paket add AlastairLundy.CliInvoke.Specializations --version 2.0.0-alpha.7
#r "nuget: AlastairLundy.CliInvoke.Specializations, 2.0.0-alpha.7"
#:package AlastairLundy.CliInvoke.Specializations@2.0.0-alpha.7
#addin nuget:?package=AlastairLundy.CliInvoke.Specializations&version=2.0.0-alpha.7&prerelease
#tool nuget:?package=AlastairLundy.CliInvoke.Specializations&version=2.0.0-alpha.7&prerelease
CliInvoke.Specializations
This readme covers the CliInvoke Specializations library. Looking for the CliInvoke Readme?
Usage
CliInvoke.Specializations comes with 3 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 .
using AlastairLundy.CliInvoke.Core;
using AlastairLundy.CliInvoke.Builders;
using AlastairLundy.CliInvoke.Core.Builders;
using AlastairLundy.CliInvoke.Core.Extensibility;
using AlastairLundy.CliInvoke.Specializations.Configurations;
using AlastairLundy.CliInvoke.Specializations;
// ServiceProvider and Dependency Injection code ommitted for clarity
IProcessInvoker _processInvoker = serviceProvider.GetRequiredService<IProcessInvoker>();
IRunnerProcessCreator _runnerProcessCreator = serviceProvider.GetRequiredService<IRunnerProcessCreator>();
//Build your command fluently
IProcessConfigurationBuilder builder = new ProcessConfigurationBuilder(
new CmdProcessConfiguration("Your arguments go here"))
.WithWorkingDirectory(Environment.SystemDirectory);
ProcessConfiguration config = builder.Build();
ProcessConfiguration processToRun = _runnerProcessCreator.CreateRunnerProcess(config);
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;
using AlastairLundy.CliInvoke.Specializations.Configurations;
using AlastairLundy.CliInvoke.Specializations;
// ServiceProvider and Dependency Injection code ommitted for clarity
IProcessInvoker _processInvoker = serviceProvider.GetRequiredService<IProcessInvoker>();
IRunnerProcessCreator _runnerProcessCreator = serviceProvider.GetRequiredService<IRunnerProcessCreator>();
//Build your command fluently
IProcessConfigurationBuilder builder = new ProcessConfigurationBuilder(
new CmdProcessConfiguration("Your arguments go here"))
.WithWorkingDirectory(Environment.SystemDirectory);
ProcessConfiguration config = builder.Build();
ProcessConfiguration processToRun = _runnerProcessCreator.CreateRunnerProcess(config);
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 .
using AlastairLundy.CliInvoke.Core;
using AlastairLundy.CliInvoke.Builders;
using AlastairLundy.CliInvoke.Core.Builders;
using AlastairLundy.CliInvoke.Core.Extensibility;
using AlastairLundy.CliInvoke.Specializations.Configurations;
using AlastairLundy.CliInvoke.Specializations;
// ServiceProvider and Dependency Injection code ommitted for clarity
IProcessInvoker _processInvoker = serviceProvider.GetRequiredService<IProcessInvoker>();
IRunnerProcessCreator _runnerProcessCreator = serviceProvider.GetRequiredService<IRunnerProcessCreator>();
//Build your command fluently
IProcessConfigurationBuilder builder = new ProcessConfigurationBuilder(
new ClassicPowershellProcessConfiguration("Your arguments go here"))
.WithWorkingDirectory(Environment.SystemDirectory);
ProcessConfiguration config = builder.Build();
ProcessConfiguration processToRun = _runnerProcessCreator.CreateRunnerProcess(config);
BufferedProcessResult result = await _processInvoker.ExecuteBufferedAsync(processToRun);
PowershellProcessConfiguration
The PowershellProcessConfiguration's TargetFilePath points to the installed copy of cross-platform Powershell if it is installed.
using AlastairLundy.CliInvoke.Core;
using AlastairLundy.CliInvoke.Builders;
using AlastairLundy.CliInvoke.Core.Builders;
using AlastairLundy.CliInvoke.Core.Extensibility;
using AlastairLundy.CliInvoke.Specializations.Configurations;
using AlastairLundy.CliInvoke.Specializations;
// ServiceProvider and Dependency Injection code ommitted for clarity
IProcessInvoker _processInvoker = serviceProvider.GetRequiredService<IProcessInvoker>();
IRunnerProcessCreator _runnerProcessCreator = serviceProvider.GetRequiredService<IRunnerProcessCreator>();
//Build your command fluently
IProcessConfigurationBuilder builder = new ProcessConfigurationBuilder(
new PowershellProcessConfiguration("Your arguments go here"))
.WithWorkingDirectory(Environment.SystemDirectory);
ProcessConfiguration config = builder.Build();
ProcessConfiguration processToRun = _runnerProcessCreator.CreateRunnerProcess(config);
BufferedProcessResult result = await _processInvoker.ExecuteBufferedAsync(processToRun);
Licensing
CliInvoke and CliInvoke Specializations are licensed under the MPL 2.0 license. If you modify any of CliInvoke's or CliInvoke.Specialization's files then the modified files must be licensed under the MPL 2.0 .
If you use CliInvoke or CliInvoke.Specializations in your project please make an exact copy of the contents 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 | 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. |
-
net8.0
- AlastairLundy.CliInvoke.Core (>= 2.0.0-alpha.7)
-
net9.0
- AlastairLundy.CliInvoke.Core (>= 2.0.0-alpha.7)
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.0.0-beta.2 | 61 | 10/1/2025 |
2.0.0-beta.1 | 52 | 9/27/2025 |
2.0.0-alpha.8 | 114 | 9/25/2025 |
2.0.0-alpha.7 | 241 | 9/15/2025 |
2.0.0-alpha.6 | 145 | 8/25/2025 |
2.0.0-alpha.5 | 198 | 8/7/2025 |
2.0.0-alpha.4 | 150 | 8/4/2025 |
2.0.0-alpha.3 | 47 | 7/19/2025 |
1.6.0 | 66 | 10/1/2025 |
1.5.2 | 292 | 9/16/2025 |
1.5.1 | 162 | 8/25/2025 |
1.4.5 | 164 | 7/10/2025 |
1.4.4 | 168 | 7/7/2025 |
1.4.3 | 174 | 6/23/2025 |
1.4.1 | 327 | 6/11/2025 |
1.3.1 | 137 | 5/23/2025 |
1.3.0 | 170 | 5/19/2025 |
1.2.1 | 185 | 5/19/2025 |
1.2.0 | 198 | 4/8/2025 |
1.1.0 | 177 | 3/20/2025 |
1.0.0 | 157 | 3/2/2025 |
Updated to CliInvoke 2.0.0 Alpha 7