Possible source generator fix #495
Replies: 4 comments 2 replies
-
@Briaoeuidhtns No, I haven't tried to re-run the generators that should be aware of the generated code, from your this generator It's worth a try! |
Beta Was this translation helpful? Give feedback.
-
@Briaoeuidhtns Did it work? |
Beta Was this translation helpful? Give feedback.
-
@Briaoeuidhtns I got a bit curious, and I also gave it a shot. As far as I can see, this would only work if Refit exposed InterfaceStubGenerator in the Refit package. This is, unfortunately, not the case right now. We could try to duplicate it, but that would be a bit counter-productive as we will need to keep it in sync with Refits implementation |
Beta Was this translation helpful? Give feedback.
-
@Briaoeuidhtns I have started building another solution that involves MSBuild custom tasks that would generate the code into files on disk pre-compile time. It has a bit of the same solution as the source generator where it recursively scans for The build output of the MSBuild task looks something like this:
The difference in this approach is that code generation requires a new build, whereas source generators can incrementally generate code in the background as you make changes in Visual Studio. I don't always use Visual Studio, so I have a habit of building the solution from the CLI which makes this solution suitable for me |
Beta Was this translation helpful? Give feedback.
-
I came across this recent comment that suggests a workaround for dependent source generators. I can look into it myself, but I want to make sure it's not something that's been tried already.
Beta Was this translation helpful? Give feedback.
All reactions