How do I trigger a source generator from a *.razor file? #75048
-
As the title says, I'm trying to figure out how to trigger a call to my ISourceGenerator implementation when I modify and save a *.razor file. As of now, I've only managed to trigger it when I modify and save a *.cs file. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 20 replies
-
Well, first and foremost, you shouldn't be using ISourceGenerator. You should be using IIncrementalGenerator, see https://github.com/dotnet/roslyn/blob/main/docs/features/incremental-generators.md and https://github.com/dotnet/roslyn/blob/main/docs/features/incremental-generators.cookbook.md. In an incremental generator, you'd base your generator on the additional files provider, and go from there. |
Beta Was this translation helpful? Give feedback.
@jasonmalinowski this was a recent bug fix to support saving additional files. Previously, we only hooked up to actual Roslyn docs (c#/vb etc)