Aam.Rs 1.4.0

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

aam-rs for C#

C# bindings for the aam-rs AAML parser using the stable C FFI.

Features

  • AAML Parsing: Parse and manipulate .aam configuration files
  • Cross-platform: Supports Windows, macOS, and Linux (x64, ARM64)
  • Type-safe: Strongly-typed C# API with proper resource management
  • Zero-copy: Efficient bindings using P/Invoke
  • Schema Validation: Built-in schema and type system support

Installation

Via NuGet

dotnet add package Aam.Rs

Or via Package Manager:

Install-Package Aam.Rs

Prerequisites

The managed package requires the native aam_rs library at runtime:

  • Windows: aam_rs.dll
  • macOS: libaam_rs.dylib
  • Linux: libaam_rs.so

The NuGet package includes pre-built native libraries for:

  • Windows (x64)
  • macOS (x64, ARM64)
  • Linux (x64)

For local development

Build the native library from the repository:

cd aam-rs/
cargo build --release --features ffi

Then set the library path:

  • Linux/macOS: export LD_LIBRARY_PATH=/path/to/target/release:$LD_LIBRARY_PATH
  • Windows: Add the directory to your PATH

Usage

Basic Parsing

using AamRs;

// Parse AAML content
using var doc = AamDocument.Parse("host = localhost\nport = 8080");

// Look up values
string host = doc.FindObj("host");      // "localhost"
string port = doc.FindObj("port");      // "8080"

Merging Configurations

using var doc = AamDocument.Parse("host = localhost\nport = 8080");

// Merge additional configuration
doc.Merge("port = 9090\ndebug = true");

var port = doc.FindObj("port");   // "9090"
var debug = doc.FindObj("debug"); // "true"

Finding Keys by Value

using var doc = AamDocument.Parse(@"
database = postgres
cache = redis
messaging = rabbitmq
");

// Search by value to find its key
string key = doc.FindKey("postgres"); // "database"

Loading from Files

using var doc = AamDocument.Load("config.aam");

Building and Testing

Solution Layout

  • aam-rs.csproj - class library (NuGet package)
  • tests/AamRs.Tests.csproj - test project
  • examples/AamRs.Examples.csproj - runnable examples
  • apps/AamRs.Console/AamRs.Console.csproj - console app
  • AamRs.sln - solution that includes all projects

Build

dotnet build AamRs.sln

Run Tests

dotnet test AamRs.sln

Run Examples

dotnet run --project examples/AamRs.Examples.csproj -- basic
dotnet run --project examples/AamRs.Examples.csproj -- load

Run Console App

dotnet run --project apps/AamRs.Console/AamRs.Console.csproj -- parse "host = localhost"
dotnet run --project apps/AamRs.Console/AamRs.Console.csproj -- load ./examples/config.aam

Note: Some tests require the native library to be available. On CI systems without native artifacts, tests gracefully skip with DllNotFoundException.

Supported Platforms

Platform Arch Status
Windows x86_64
macOS x86_64
macOS ARM64
Linux x86_64

API Reference

AamDocument

Main class for AAML document handling.

Parse(string content): AamDocument

Parses AAML content from a string.

Load(string path): AamDocument

Loads an AAML file from disk.

FindObj(string key): string?

Finds an object/value by key.

FindKey(string value): string?

Finds a key by its value.

FindDeep(string path): string?

Finds a nested value using dot notation (e.g., "parent.child").

Merge(string content): void

Merges additional AAML content into the current document.

Dispose(): void

Releases native resources. Implement via using statement.

Error Handling

The C# bindings use standard .NET exceptions:

try
{
    using var doc = AamDocument.Parse("invalid content");
}
catch (InvalidOperationException ex)
{
    // Handle parse errors
    Console.WriteLine($"Parse error: {ex.Message}");
}
catch (DllNotFoundException ex)
{
    // Handle missing native library
    Console.WriteLine($"Native library not found: {ex.Message}");
}

License

Licensed under either of:

at your option.

Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Aam.Rs:

Package Downloads
AamRs.Examples

Package Description

AamRs.Console

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.4.0 167 3/19/2026