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
- .NET CLI
- Package Manager
<PackageReference Include="Riok.Mapperly" Version="3.2.0" />
dotnet add package Riok.Mapperly
It is possible to remove Mapperly runtime references completely by setting
ExcludeAssets="runtime" on the
PrivateAssets="all" ensures that projects referencing this project do not also get a reference to
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
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
and reduce the download size.
Riok.Mapperly.Abstractions will probably never be needed anyway.