MapsterExtensions.Generator 3.1.0

dotnet add package MapsterExtensions.Generator --version 3.1.0
                    
NuGet\Install-Package MapsterExtensions.Generator -Version 3.1.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="MapsterExtensions.Generator" Version="3.1.0">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MapsterExtensions.Generator" Version="3.1.0" />
                    
Directory.Packages.props
<PackageReference Include="MapsterExtensions.Generator">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
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 MapsterExtensions.Generator --version 3.1.0
                    
#r "nuget: MapsterExtensions.Generator, 3.1.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 MapsterExtensions.Generator@3.1.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=MapsterExtensions.Generator&version=3.1.0
                    
Install as a Cake Addin
#tool nuget:?package=MapsterExtensions.Generator&version=3.1.0
                    
Install as a Cake Tool

MapsterExtensions.Generator

Generate extension methods from your Mapster mappings.

Installation

dotnet add package Mapster
dotnet add package MapsterExtensions.Generator

Usage

using Mapster;
using MapsterExtensions.Generator;

public class MappingConfig : IRegister
{
    [Generate]
    public void Register(TypeAdapterConfig config)
    {
        config.NewConfig<User, UserDto>();
    }
}

Register your configuration (if not already done):

// Program.cs
TypeAdapterConfig.GlobalSettings.Scan(Assembly.GetExecutingAssembly());

Build. Use the generated extensions:

user.ToUserDto()

License

This project is licensed under the MIT License.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

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
3.1.0 199 8/21/2025
3.0.0 123 8/21/2025
2.1.0 126 8/21/2025
2.0.0 127 8/21/2025
1.0.0 296 8/20/2025