internal Compilation CreateCompiler(IEnumerable <MapBase> mappings, params SyntaxTree[] trees)
        {
            var references = _commonReferences.Get().Union(_mappingReferences.Get(mappings.ToList())).ToList();

            var options = new CSharpCompilationOptions(
                OutputKind.DynamicallyLinkedLibrary,
                optimizationLevel: OptimizationLevel.Release,
                allowUnsafe: true);

            return(CSharpCompilation.Create(_options.AssemblyName, trees, references, options));
        }
Exemple #2
0
        public void CommonReferences_ForMapping_Get_ReturnsReferences()
        {
            var commonReferences = new CommonReferences();

            var references = commonReferences.Get().ToList();

            references[0].Display.ShouldContain("mscorlib.dll");
            references[1].Display.ShouldContain("System.Runtime.dll");
            references[2].Display.ShouldContain("Private.CoreLib.dll");
            references[3].Display.ShouldContain("System.Collections.dll");
            references[4].Display.ShouldContain("netstandard.dll");
        }