Skip to main content

Generated source

Most IDEs allow you to view the source code generated by Mapperly. Usually you can jump to the implementation via the partial mapper method. If your IDE doesn't easily allow this or if you want to check in the generated source into source control, you can emit the generated files.

To emit the generated files to disk set the EmitCompilerGeneratedFiles property:

<PropertyGroup>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
</PropertyGroup>

By default the files are written to {BaseIntermediateOutpath}/generated/{Assembly}/Riok.Mapperly/{GeneratedFile}. With BaseIntermediateOutpath for example being obj/Debug/net7.0.

The output path can be customized via the CompilerGeneratedFilesOutputPath property.

<PropertyGroup>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>Generated</CompilerGeneratedFilesOutputPath>
</PropertyGroup>
info

Mapperly only emits updated source code on build. You won't see the updated mapper code or mapper diagnostics until you perform a build.

This is done for performance reasons, otherwise the IDE could become laggy. Improvements are tracked in #72.