dotnet/roslyn

Source generators: unique files names

Opened this issue · 1 comments

We currently set the filename of an added syntax tree to the provided hintName, which is only ensured to be unique per-generator.

We should make the names some combination of generator name and hint name to ensure global uniqueness.

I'm hitting "The hintName of the added source file must be unique within a generator" error message. This happens only when MSBuild's NodeReuse is set to true. I might be wrong but the error disappeared when I set it to false. In a similar project, when the output paths change to a global location (although separated by ProjectName), this error occurs again.