Skip to content

About

Read and write .aasx packages.

Resources

Stars

9 stars

Watchers

2 watching

Forks

Latest commit

 

History

57 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aas-package3-csharp

Test Check style Check Doc Nuget

Aas-package3-csharp is a library for reading and writing packaged file format of an Asset Administration Shell (AAS) in C#.

Status

The library is thoroughly tested and meant to be used in production.

.NET 10, .NET Framework 4.6.2 and later, as well as .NET Standard 2.0 and 2.1 are supported. Version 2 dropped the dedicated builds for .NET 8 and 9, which reached their end of support in November 2026.

Documentation

The documentation is available at https://eclipse-aascw.github.io/aas-package3-csharp/doc.

Teaser

Here is are short snippets to demonstrate how you can use the library.

To create and write to a package:

// General packaging handler to be shared accross the program
var packaging = new AasCore.Aas3.Package.Packaging();

// Create a package
{
    byte[] specContent = ...;
    byte[] thumbnailContent = ...;
    byte[] supplementaryContent = ...;

    using var pkg = packaging.Create("/path/to/some/file");
    var spec = pkg.MakeSpec(
        pkg.PutPart(
            new Uri(
                "/aasx/some-company/data.json", 
                UriKind.Relative),
            "text/json",
            specContent);

    pkg.MakeThumbnail(
        pkg.PutPart(
            new Uri(
                "/some-thumbnail.png", 
                UriKind.Relative),
            "image/png",
            thumbnailContent));

    pkg.RelateSupplementaryToSpec(
        pkg.PutPart(
            new Uri(
                "/aasx-suppl/some-company/some-manual.pdf",
                 UriKind.Relative),
            "application/pdf",
            supplementaryContent),
        spec);

    pkg.Flush();
}

To read from the package:

// General packaging handler to be shared accross the program
var packaging = new AasCore.Aas3.Package.Packaging();

// Read from the package
byte[] specContent;
byte[] thumbnailContent;
byte[] supplementaryContent;

{
    using var pkgOrErr = packaging.OpenRead(
        "/path/to/some/file");

    var pkg = pkgOrErr.Must();

    // Read the specs
    var specsByContentType = pkg.SpecsByContentType();
    if (!specsByContentType.ContainsKey("text/json"))
    {
        throw new ArgumentException("No json specs");
    }
    var spec = specsByContentType["text/json"].First();
    specContent = spec.ReadAllBytes();

    // Read the thumbnail
    var thumbnail = pkg.Thumbnail();
    if(thumbnail != null)
    {
        thumbnailContent = pkg.Thumbnail().ReadAllBytes();

        // Do something with the thumbnail content
    }

    // Read the supplementary file
    supplementaryContent = pkg
        .MustPart(
            new Uri(
                "/aasx-suppl/some-company/some-manual.pdf",
                 UriKind.Relative))
        .ReadAllBytes();
}

Please see the full documentation at [https://eclipse-aascw.github.io/aas-package3-csharp/doc] for more details.

Installation

The library is available on NuGet at: https://www.nuget.org/packages/AasCore.Aas3.Package/

Versioning

The name of the library indicates the supported version of the Asset Administration Shell (AAS).

In case of aas-package3-csharp, this means that the Version 3 of the Asset Administration Shell (AAS) is supported.

We follow Semantic Versioning to version the library. The version X.Y.Z indicates:

  • X is the major version (backward-incompatible),
  • Y is the minor version (backward-compatible), and
  • Z is the patch version (backward-compatible bug fix).

About

Read and write .aasx packages.

Resources

Stars

9 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages