OpenDsc.Resource.CommandLine 0.5.1

Prefix Reserved
dotnet add package OpenDsc.Resource.CommandLine --version 0.5.1
                    
NuGet\Install-Package OpenDsc.Resource.CommandLine -Version 0.5.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="OpenDsc.Resource.CommandLine" Version="0.5.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OpenDsc.Resource.CommandLine" Version="0.5.1" />
                    
Directory.Packages.props
<PackageReference Include="OpenDsc.Resource.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 OpenDsc.Resource.CommandLine --version 0.5.1
                    
#r "nuget: OpenDsc.Resource.CommandLine, 0.5.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 OpenDsc.Resource.CommandLine@0.5.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=OpenDsc.Resource.CommandLine&version=0.5.1
                    
Install as a Cake Addin
#tool nuget:?package=OpenDsc.Resource.CommandLine&version=0.5.1
                    
Install as a Cake Tool

OpenDsc.Resource.CommandLine

The OpenDsc.Resource.CommandLine package contains a command-line and resource manifest generator for Microsoft DSC v3 resources.

Installation

Install the package via NuGet:

dotnet add package OpenDsc.Resource.CommandLine

Usage

This package provides a CommandBuilder class that generates a System.CommandLine.RootCommand for your DSC resource(s). The command structure includes:

  • get: Get the current state of a resource instance
  • set: Set the desired state of a resource instance
  • test: Test if a resource instance is in the desired state
  • delete: Delete a resource instance
  • export: Export all instances of a resource
  • schema: Get the JSON schema for a resource
  • manifest: Generate the DSC resource manifest(s)

Single Resource Example

using OpenDsc.Resource.CommandLine;

var resource = new Resource(SourceGenerationContext.Default);
var command = new CommandBuilder()
    .AddResource<Resource, Schema>(resource)
    .Build();
return command.Parse(args).Invoke();

Multi-Resource Example

Note: Requires DSC v3.2 or later.

You can register multiple resources in a single executable:

using OpenDsc.Resource.CommandLine;

var fileResource = new FileResource(SourceGenerationContext.Default);
var userResource = new UserResource(SourceGenerationContext.Default);
var serviceResource = new ServiceResource(SourceGenerationContext.Default);

var command = new CommandBuilder()
    .AddResource<FileResource, FileSchema>(fileResource)
    .AddResource<UserResource, UserSchema>(userResource)
    .AddResource<ServiceResource, ServiceSchema>(serviceResource)
    .Build();

return command.Parse(args).Invoke();

When multiple resources are registered, all commands require the --resource parameter to specify which resource to operate on.

Commands

get

Retrieves the current state of the resource.

# Single resource
app get --input '{"property": "value"}'

# Multi-resource
app get --resource 'Owner/ResourceName' --input '{"property": "value"}'

set

Sets the desired state of the resource.

# Single resource
app set --input '{"property": "value"}'

# Multi-resource
app set --resource 'Owner/ResourceName' --input '{"property": "value"}'

test

Tests if the resource is in the desired state.

# Single resource
app test --input '{"property": "value"}'

# Multi-resource
app test --resource 'Owner/ResourceName' --input '{"property": "value"}'

delete

Deletes the resource instance.

# Single resource
app delete --input '{"property": "value"}'

# Multi-resource
app delete --resource 'Owner/ResourceName' --input '{"property": "value"}'

export

Exports all instances of the resource.

# Single resource
app export

# Multi-resource
app export --resource 'Owner/ResourceName'

schema

Outputs the JSON schema for the resource.

# Single resource
app schema

# Multi-resource
app schema --resource 'Owner/ResourceName'

manifest

Generates the resource manifest(s).

# Single resource - output to console
app manifest

# Single resource - save to file
app manifest --save

# Multi-resource - all manifests to console
app manifest

# Multi-resource - save all manifests to file
app manifest --save

# Multi-resource - specific resource manifest
app manifest --resource 'Owner/ResourceName'

Requirements

  • .NET Standard 2.0 or higher
  • Depends on OpenDsc.Resource and System.CommandLine
  • DSC v3.2+ required for multi-resource support

License

MIT

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 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. 
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
0.5.1 67 3/25/2026
0.5.0 77 3/24/2026
0.4.0 213 12/23/2025
0.3.1 341 12/17/2025
0.3.0 443 12/9/2025
0.2.0 165 7/17/2025
0.1.2 146 6/30/2025
0.1.1 141 6/30/2025
0.1.0 79 6/28/2025