Gedcom.Vector 1.0.0

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

Gedcom.Vector

A portable .NET 8 GEDCOM 5.5.1 parser, lexer, encoder, and serializer. Zero genealogy-app-specific dependencies — just Microsoft.Extensions abstractions.

CI NuGet License: PolyForm Noncommercial


Features

  • 📄 Full GEDCOM 5.5.1 support — parses HEAD, INDI, FAM, OBJE, and TRLR records
  • 🔡 Multi-encoding support — UTF-8 (with/without BOM), UTF-16 (with BOM), ANSEL, and ANSI/Windows-1252
  • Streaming lexer — low-allocation line-by-line tokeniser backed by GedcomLexer and GedcomTreeBuilder
  • 📦 NuGet-ready — structured for dotnet pack with symbols (.snupkg)
  • 💉 DI-friendly — integrates with Microsoft.Extensions.DependencyInjection via AddGedcomImport()
  • 🔒 No app-specific dependencies — only Microsoft.Extensions.* abstractions; no EF Core, no ASP.NET, no databases
  • Deterministic builds — reproducible byte-for-byte output

Quick Start

Install

dotnet add package Gedcom.Vector

Register with Dependency Injection

// Program.cs / Startup.cs
builder.Services.AddGedcomImport(builder.Configuration);

This registers IGedcomImportAdapter as a singleton, bound to the GedcomImport configuration section.

// appsettings.json
{
  "GedcomImport": {
    "MaxFileSizeBytes": 52428800
  }
}

Parse a GEDCOM file

public class MyService(IGedcomImportAdapter gedcom)
{
    public GedcomParseResult Import(Stream gedcomStream)
    {
        var result = gedcom.Parse(gedcomStream);

        foreach (var person in result.Persons)
            Console.WriteLine($"{person.FirstName} {person.LastName}");

        foreach (var family in result.Families)
            Console.WriteLine($"Family: {family.HusbandXref} + {family.WifeXref}");

        return result;
    }
}

Export to GEDCOM

public class ExportService(IGedcomExportWriter writer)
{
    public async Task ExportAsync(GedcomParseResult data, Stream output)
    {
        await writer.WriteAsync(data, output);
    }
}

Without DI (direct use)

using var stream = File.OpenRead("family.ged");
var adapter = new GedcomImportAdapter(
    NullLogger<GedcomImportAdapter>.Instance,
    Options.Create(new GedcomImportOptions { MaxFileSizeBytes = 10_000_000 })
);
var result = adapter.Parse(stream);

Encoding Detection

GedcomEncodingDetector automatically selects the correct decoder:

Declared CHAR tag Encoding used
UTF-8 UTF-8
UNICODE UTF-16 LE/BE (via BOM)
ANSEL Custom ANSEL decoder
ANSI Windows-1252
(absent) UTF-8 (default)

BOM detection takes priority over the declared tag.


Configuration

Option Type Default Description
MaxFileSizeBytes long 52428800 Maximum allowed GEDCOM file size (bytes)

Project Structure

gedcom-vector/
├── src/
│   └── Gedcom.Vector/
│       ├── Parsing/           # Lexer, tree builder, ANSEL decoder
│       ├── GedcomImportAdapter.cs
│       ├── GedcomExportWriter.cs
│       ├── GedcomEncodingDetector.cs
│       └── ...
├── tests/
│   └── Gedcom.Vector.Tests/
│       ├── AnselDecoderTests.cs
│       ├── GedcomEncodingDetectorTests.cs
│       └── ...
├── .github/workflows/
│   ├── ci.yml
│   └── publish.yml
├── LICENSE
└── README.md

License

Free for non-commercial use under the PolyForm Noncommercial License 1.0.0.

This covers:

  • Personal projects, hobby use, research, and education
  • Non-profit and public-sector organizations

Commercial use requires a separate license. Please open an issue or contact the author to discuss commercial licensing terms.


Contributing

This library is extracted from the FAMTree project. Bug reports and suggestions are welcome via GitHub Issues.

Product 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 was computed.  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. 
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
1.3.2 109 7/22/2026
1.3.1 103 7/22/2026
1.3.0 94 7/21/2026
1.2.3 153 7/21/2026
1.2.2 101 7/21/2026
1.2.1 145 7/21/2026
1.2.0 101 7/21/2026
1.1.1 107 7/13/2026
1.1.0 112 7/12/2026
1.0.0 402 7/12/2026