XML serialize Roslyn SyntaxTree?

I am looking for options for converting C # to XML, and again deserializing back to C #. Does anyone know of existing solutions for this? I assume Roslyn SyntaxTree is not Xml-serializable. I also suggest that creating an xml serializer for syntaxtree would be a pretty big undertaking. But it can’t be?

Why do I need it? I want to generate code from an xml model via xsl to syntaxtree-xml and then to C # (or maybee vb).

I do not want to generate C # directly from XSL (it can be done, but I do not think this is ideal). I need XSL because I'm also going to generate XAML and HTML from an XML model, and I also want to be able to generate any necessary code, etc.

I know about T4 templates, but right now I'm considering other options for various reasons.

+5
source share
1 answer

Roslyn is an open compiler. I assume that you can directly paste your own code to go through AST and upload it in XML format. Given that it is open, you can implement your own extension to read your resettable XML, and build Roslyn AST (which, I think, can be pretty). It seems like a lot of work.

For a canned solution, see C # AST in XML . A similar read-XML-to-make-AST would be required for this solution.

, XML ; , , . . AST ( ) - ?.

, , , , . DMS ( ), , #, API // AST. (XSL , : "" (, ), , ).

+3

All Articles