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
- Project File (.csproj)
- .NET CLI
dotnet build /p:EmitCompilerGeneratedFiles=true
By default the files are written to
BaseIntermediateOutpath for example being
The output path can be customized via the
This can be used to check the generated files into VCS.
If the project path is inside the project directory structure,
the files are picked up by the compiler additionally to the in-memory source generator output.
Therefore the files need to be explicitly removed from the compilation.
<!-- Exclude the output of source generators from the compilation, show it in the IDE -->
<Compile Remove="$(CompilerGeneratedFilesOutputPath)/**/*.cs" />
<None Include="$(CompilerGeneratedFilesOutputPath)/**/*.cs" />
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.