AArnott / CodeGeneration.Roslyn

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

Provide distinct Usings for final generated compliation unit #232

Closed stevenknox closed 3 years ago

stevenknox commented 4 years ago

When using multiple different generators that have an overlap of Using Directives , the resulting consumer project may get a CS0105 warning "The using directive for 'Foo' appeared previously in this namespace"

I have applied Distinct() to ensure there are no duplicates in the final generated compilation.

amis92 commented 4 years ago

Please add a test based on

https://github.com/AArnott/CodeGeneration.Roslyn/blob/fd1200769415b5428fbd6c5859dbe55cf78f0b7b/src/CodeGeneration.Roslyn.Tests.Generators/AddGeneratedUsingGenerator.cs

and

https://github.com/AArnott/CodeGeneration.Roslyn/blob/master/src/CodeGeneration.Roslyn.Tests/DocumentTransformTests.cs

Shouldn't be too complicated :)

stevenknox commented 4 years ago

Perfect! ill get a test added for this first thing in the morning =)

AArnott commented 3 years ago

This project is getting archived in favor of Source Generators. See #229