From 7de481a3a9fa13ca2f17cddf43e1097dafdd51e8 Mon Sep 17 00:00:00 2001 From: Amy Date: Sun, 6 Oct 2024 14:22:35 +0100 Subject: [PATCH] docs: added documentation to help with seeing the generated files This gives some helpful tips for showing the output of the generator --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/README.md b/README.md index ab78f76..89ea9b2 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,33 @@ x.SetPropertyByName("Size", 42); //20X faster than using reflection --- +## Tip: What's actually generated? + +It can be difficult to see the output of the generated files. You might want to check them to see if something has gone wrong (if so please raise an issue). You might also want to include the generated classes in your source control to keep track of any unintended changes. + +If you update your project file with the following properties, it will tell the source generator to save the files to disk in the specified location. + +1. ``: Set this to `true` to save the generated files to disk. +2. ``: Set this to change the folder (relative to your project root folder) where the generated files are saved. +3. *Optional*: ``: Set this to further split up the generated files by the target framework (net481, netstandard2.0, net8.0, etc.). If you're only targeting one framework during compilation, you don't need this property. +4. ``: This is needed to exclude the generated files from compilation as the in-memory source generator is used during compilation. + +```xml + + true + Generated + $(GeneratedFolder)\$(TargetFramework) + + + + + +``` + +[More information on saving source generator output](https://andrewlock.net/creating-a-source-generator-part-6-saving-source-generator-output-in-source-control/) + +--- + ## Tip: Using it with Dapper If you're already using the awesome [Dapper ORM](https://github.com/DapperLib/Dapper) by Marc Gravel, Sam Saffron and Nick Craver, this is how you can use our library to speed up DataReader-to-object mapping in Dapper: