Skip to main content

Installation

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="3.2.0" />
info

It is possible to remove Mapperly runtime references completely by setting PrivateAssets="all" and ExcludeAssets="runtime" on the PackageReference.
PrivateAssets="all" ensures that projects referencing this project do not also get a reference to Riok.Mapperly.
ExcludeAssets="runtime" ensures that the Mapperly .dll files are not copied to the build output.

Removing the runtime dependency comes with the disadvantage that whenever the runtime tries to load a referenced attribute from Riok.Mapperly.Abstractions a FileNotFoundException is thrown. This is, for example, the case if typeof(MyMapper).GetCustomAttributes() is called.

In Blazor Wasm applications <BlazorWebAssemblyLazyLoad Include="Riok.Mapperly.Abstractions.dll" /> can be added to lazily load Riok.Mapperly.Abstractions and reduce the download size. Riok.Mapperly.Abstractions will probably never be needed anyway.