Skip to main content

Installation

Requirements

  • .NET 5+ or .NET Framework 4.x.
  • C# language version 9 or later
  • Roslyn 4.0 or later

Add the NuGet Package to your project

All you need to do, to install Mapperly is to add a NuGet reference pointing to the package Riok.Mapperly.

<PackageReference Include="Riok.Mapperly" Version="4.3.0" ExcludeAssets="runtime" PrivateAssets="all" />

Release Channels

Mapperly is distributed through two release channels:

  • Stable Channel: Production-ready releases with full support for latest release. Install the latest stable version for production use. Subject to semantic versioning (breaking changes only in major version bumps).
  • Next Channel: Preview releases with upcoming features and improvements. These versions may contain breaking changes and are not subject to semantic versioning. Use for testing and early access to new features.

Support policy

Only the latest version released on the stable channel is fully supported. We strive to support all .NET versions that are currently supported by Microsoft.

Preserving the attributes at runtime

Mapperly removes the attribute references at compile time by default (they have the ConditionalAttribute). If you want to preserve the attribute references at runtime you can set the MSBuild variable MapperlyAbstractionsScope to runtime.

<PropertyGroup>
<MapperlyAbstractionsScope>runtime</MapperlyAbstractionsScope>
</PropertyGroup>
info

When preserving the attribute usages, the Mapperly package reference needs to include the runtime assets.
Make sure ExcludeAssets on the PackageReference does not include runtime.

info

MapperlyAbstractionsScope only works in projects referencing Riok.Mapperly directly. Alternatively you can set a constant MAPPERLY_ABSTRACTIONS_SCOPE_RUNTIME:

<PropertyGroup>
<DefineConstants>$(DefineConstants);MAPPERLY_ABSTRACTIONS_SCOPE_RUNTIME</DefineConstants>
</PropertyGroup>