AArnott / CodeGeneration.Roslyn

Assists in performing Roslyn-based code generation during a build.
Microsoft Public License
408 stars 59 forks source link

Document default behavior for unqualified generator name in CodeGenerationAttribute #58

Closed amis92 closed 5 years ago

amis92 commented 6 years ago

https://github.com/AArnott/CodeGeneration.Roslyn/blob/b889381999dd62ed03cc4051b07a2dd63dbedc88/src/CodeGeneration.Roslyn/DocumentTransform.cs#L161

amis92 commented 5 years ago

The behavior is now documented: https://github.com/AArnott/CodeGeneration.Roslyn/wiki/Features#codegenerationattributeattribute

Snippet:

A member annotated with an attribute (that in turn was annotated with CodeGenerationAttributeAttribute) is recognized by the Engine; the type of code generator is read from attribute's CodeGenerationAttributeAttribute constructor parameter. This is either typeof(x) expression which requires code generator to live in the same assembly as the generator, or a string constant containing fully qualified type name, e.g. CodeGeneration.Roslyn.Tests.Generators.EmptyPartialGenerator, CodeGeneration.Roslyn.Tests.Generators. If you omit the assembly name (after comma), it'll resolve to the same assembly as the one in which the attribute itself was declared.