SourceGenerator and LibraryImport

I am considering writing my own source generator. Among other things it will also generate some PInvoke bindings. Ideally, I'd like to use LibraryImport instead of DllImport in the generated source. But since LibraryImport in itself is a generator, can I do this?
2 Replies
Jimmacle
Jimmacle8mo ago
if your source generator emits LibraryImport attributes no, source generators don't run on the output of source generators
SleepWellPupper
SleepWellPupper8mo ago
You could consider a codefix that generates actual files into user projects. Those would be considered by SGs.
Want results from more Discord servers?
Add your server