Ejemplo n.º 1
0
        private AssemblyNeutralWorker DoAssemblyNeutralCompilation(params string[] fileContents)
        {
            var compilation = CSharpCompilation.Create("test",
                                                       options: new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary),
                                                       references: new[] {
                MetadataReference.CreateFromAssembly(typeof(object).GetTypeInfo().Assembly)
            },
                                                       syntaxTrees: fileContents.Select(text => CSharpSyntaxTree.ParseText(text)));

            var worker = new AssemblyNeutralWorker(compilation,
                                                   new Dictionary <string, MetadataReference>());

            worker.FindTypeCompilations(compilation.GlobalNamespace);
            worker.OrderTypeCompilations();
            return(worker);
        }
Ejemplo n.º 2
0
        private AssemblyNeutralWorker DoAssemblyNeutralCompilation(params string[] fileContents)
        {
            var compilation = CSharpCompilation.Create("test",
                options: new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary),
                references: new[] {
                    MetadataReference.CreateFromAssembly(typeof(object).GetTypeInfo().Assembly)
                },
                syntaxTrees: fileContents.Select(text => CSharpSyntaxTree.ParseText(text)));

            var worker = new AssemblyNeutralWorker(compilation,
                new Dictionary<string, MetadataReference>());
            worker.FindTypeCompilations(compilation.GlobalNamespace);
            worker.OrderTypeCompilations();
            return worker;
        }