Exemplo n.º 1
0
        protected Compilation GetCompilation(string code, MetadataReference[] references = null)
        {
            IEnumerable <SyntaxTree> syntaxTrees = SimpleParseUtil.Parse(code);

            references = references ?? SimpleCompileUtil.GetDefaultMetadataReferences();
            Compilation comp = SimpleCompileUtil.GetSimpleCSharpCompilation(syntaxTrees, references);

            return(comp);
        }
Exemplo n.º 2
0
        protected Compilation GetCompilation(FileInfo codePath, MetadataReference[] references = null)
        {
            SyntaxTree syntaxTrees = SimpleParseUtil.Parse(codePath);

            references = references ?? SimpleCompileUtil.GetDefaultMetadataReferences();
            Compilation comp = SimpleCompileUtil.GetSimpleCSharpCompilation(new [] { syntaxTrees }, references);

            return(comp);
        }
Exemplo n.º 3
0
        protected Compilation GetSolutionCompilation(FileInfo solution)
        {
            MetadataReference[] references = SimpleCompileUtil.GetMetadataReferencesFromSolution(solution);
            FileInfo[]          sources    = SimpleCompileUtil.GetSourcesFromSolution(solution);

            List <SyntaxTree> trees = new List <SyntaxTree>();

            foreach (FileInfo source in sources)
            {
                trees.Add(SimpleParseUtil.Parse(source));
            }

            CSharpCompilation comp = SimpleCompileUtil.GetSimpleCSharpCompilation(trees, references);

            return(comp);
        }