using System; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; class Program { static void Main(string[] args) { var sourceCode = @"using System; class Test { static void Main(string[] args) { Console.WriteLine(""Hello, world!""); } }"; SyntaxTree syntaxTree = CSharpSyntaxTree.ParseText(sourceCode); CSharpCompilation compilation = CSharpCompilation.Create("Test.exe") .WithOptions(new CSharpCompilationOptions(OutputKind.ConsoleApplication)) .AddReferences(new MetadataReference[] { MetadataReference.CreateFromFile(typeof(Object).Assembly.Location) }) .AddSyntaxTrees(syntaxTree); var assembly = new LoadReaderWriter(compilation).LoadFromAssemblyName(compilation.AssemblyName); Type type = assembly.GetType("Test"); type.GetMethod("Main").Invoke(null, new object[] { new string[] { } }); } }In this example, we first define the source code of a simple C# program that prints "Hello, world!" to the console. Then, we create a syntax tree from the source code and compile it into an assembly using the LoadReaderWriter class. Finally, we invoke the Main method of the compiled program and print its output to the console. The package library for the LoadReaderWriter class is Microsoft.CodeAnalysis.CSharp.Scripting.