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
if your source generator emits
LibraryImport
attributes no, source generators don't run on the output of source generatorsYou could consider a codefix that generates actual files into user projects. Those would be considered by SGs.