Пример #1
0
 public RoslynEval()
 {
     if (probing == null)
     {
         probing = SimpleAsmProbing.For(".", @"..\..\..\Roslyn.Scripting");
     }
 }
Пример #2
0
        static string Compile(string compiler, string[] args)
        {
            // Debug.Assert(false);

            using (SimpleAsmProbing.For(Path.GetDirectoryName(csc)))
            {
                var oldOut = Console.Out;
                using StringWriter buff = new();

                Console.SetOut(buff);

                int exitCode = 0;
                try
                {
                    if (compiler == "csc")
                    {
                        exitCode = AppDomain.CurrentDomain.ExecuteAssembly(csc, args);
                    }
                    else
                    {
                        var vbc = Path.Join(Path.GetDirectoryName(csc), "vbc.dll");
                        exitCode = AppDomain.CurrentDomain.ExecuteAssembly(vbc, args);
                    }
                }
                catch (Exception e)
                {
                    return($"1|Build server error: {e}");
                }
                finally
                {
                    Console.SetOut(oldOut);
                }
                return($"{exitCode}|{buff.GetStringBuilder()}");
            }
        }
Пример #3
0
 public TestBase()
 {
     if (probing == null)
     {
         probing = SimpleAsmProbing.For(".", @"..\..\..\Roslyn.Scripting");
     }
     Environment.SetEnvironmentVariable("CSSCRIPT_DIR", Environment.CurrentDirectory);
 }