0

I wanted to know if it exists an equivalent of Microsoft.CodeAnalysis.CSharp.CSharpSyntaxTree for razor or cshtml documents.

My goal is to generate razor document dynamically, and I don't want to do this manually via string concatenation.

I searched for this ability but I only found CSharp and VisualBasic syntax tree available in the documentation

2
  • "Microsoft.CodeAnalysis" is for analyzing existing code, not generating code - exactly how do you propose to use it to generate razor documents? Commented Dec 22, 2023 at 20:50
  • It seems to be possible to generate source code from CSharpSyntaxTree by calling .ToString() method, wright ? Commented Dec 23, 2023 at 8:24

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.