I have a string that contains C# code. How can I check that the C# code in the string is valid C# and doesn't contain build errors?
I'd like to do this programmatically in C#.
I don't expect the code in the string to contain references to other code outside of the string, so it's not necessary to load up the whole project or solution, only the code in the string needs to be considered.
Can I use the Roslyn Api or something similar?