Extract attributes from C # source code without reflection

I want to extract custom attributes from source code from different .CS files. I have a list of files.

The scenario is that I have Project A that reads Project B files. It should extract all the attributes used in Project B

My question is how can I do this without using Reflection . Reflection refers to assemblies, but I have the source code.

Would using Roslyn be killed?

what are the approaches?

I had another option for compiling using MSBuild , but for large-scale projects this would not be possible due to heavy dependencies. and it seems like this is not a good way to build an application and then build it

I just want to have something like what tells me which attribute was in that class, and a possible UML diagram of the relationships of these classes.

Please give your suggestions.

+6
source share
1 answer

You can use NRefactory: https://github.com/icsharpcode/nrefactory (also available as a NuGet package)

+3
source

Source: https://habr.com/ru/post/914230/


All Articles