public override TemplateInfo CompileTemplate(string templateBody, Dictionary<string, Type> globalsTypes, List<Assembly> referencedAssemblies)
        {
            lock (_templateInfoCacheLock)
            {
                // Generate template program
                TemplateInfo ti = GenerateTemplateProgram(templateBody, globalsTypes, referencedAssemblies);

                // Generated template found in cache
                if (_templateInfoCache.ContainsKey(ti.TemplateKey))
                {
                    return _templateInfoCache[ti.TemplateKey];
                }

                // Generate code
                ICodeGenerator codeGenerator = new CodeGenerator();
                ti.GeneratedSourceCode = codeGenerator.GenerateCode(ti);

                // Generate assembly
                var assemblyCompiler = new AssemblyGenerator();
                Assembly assembly = assemblyCompiler.GenerateAssembly(ti, true, null, null);

                // Try to load the Render() method from assembly
                ti.RenderMethod = GetTemplateRenderMethod(assembly, ti);

                // Try to load the template generator version from assembly
                ti.GeneratorVersion = GetTemplateGeneratorVersion(assembly, ti);

                _templateInfoCache.Add(ti.TemplateKey, ti);

                return ti;
            }
        }
Esempio n. 2
0
    public static void GenExe()
    {
        AssemblyName    assemblyName    = new AssemblyName("DynAssembly");
        AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.RunAndCollect);
        var             moduleBuilder   = assemblyBuilder.DefineDynamicModule("KittyModule");
        var             typeBuilder     = moduleBuilder.DefineType("HelloKittyClass", TypeAttributes.Public);
        var             methodBuilder   = typeBuilder.DefineMethod(
            "SayHelloMethod",
            MethodAttributes.Public | MethodAttributes.Static,
            null, null);
        var il = methodBuilder.GetILGenerator();

        il.Emit(OpCodes.Ldstr, "Hello, Kitty!");
        il.Emit(OpCodes.Call, typeof(Console).GetMethod("WriteLine", new Type[] { typeof(string) }) !);
        il.Emit(OpCodes.Call, typeof(Console).GetMethod("ReadLine") !);
        il.Emit(OpCodes.Pop);
        il.Emit(OpCodes.Ret);
        var helloKittyClassType = typeBuilder.CreateType();
        // 没有设置 EntryPoint 的方法,
        // 导出 靠 ILPack 第三方库
        // isuse 说 .net 7.0 可能加入 导出和设置 EntryPoint

        var generator = new AssemblyGenerator();

        // var codes = generator.GenerateAssemblyBytes(assemblyBuilder);
        generator.GenerateAssembly(assemblyBuilder, "GenKitty.exe");
    }
Esempio n. 3
0
        public override TemplateInfo CompileTemplate(string templateBody, Dictionary <string, Type> globalsTypes, List <Assembly> referencedAssemblies)
        {
            lock (_templateInfoCacheLock)
            {
                // Generate template program
                TemplateInfo ti = GenerateTemplateProgram(templateBody, globalsTypes, referencedAssemblies);

                // Generated template found in cache
                if (_templateInfoCache.ContainsKey(ti.TemplateKey))
                {
                    return(_templateInfoCache[ti.TemplateKey]);
                }

                // Generate code
                ICodeGenerator codeGenerator = new CodeGenerator();
                ti.GeneratedSourceCode = codeGenerator.GenerateCode(ti);

                // Generate assembly
                var      assemblyCompiler = new AssemblyGenerator();
                Assembly assembly         = assemblyCompiler.GenerateAssembly(ti, true, null, null);

                // Try to load the Render() method from assembly
                ti.RenderMethod = GetTemplateRenderMethod(assembly, ti);

                // Try to load the template generator version from assembly
                ti.GeneratorVersion = GetTemplateGeneratorVersion(assembly, ti);

                _templateInfoCache.Add(ti.TemplateKey, ti);

                return(ti);
            }
        }
Esempio n. 4
0
        static RewriteTest()
        {
            // Get the original assembly
            _asmOriginal = typeof(TestSubject.MyClass).Assembly;
            _asmCloned   = typeof(TestSubject.MyClass).Assembly;
            var originalAssembly = _asmOriginal.Location;


#if USE_ORIGINAL_TESTSUBJECT
            _namespaceName = "TestSubject";
            _assembly      = originalAssembly;
#else
            // Generate the cloned assembly
            // NB: putting it in the "cloned" sub directory prevents an
            //     issue with someone (VisStudio perhaps) having the file open
            //     and preventing rewrite on subsequent run.
            var outDir = Path.Combine(Path.GetDirectoryName(originalAssembly), "cloned");
            Directory.CreateDirectory(outDir);
            var clonedAssembly = Path.Combine(outDir, "ClonedTestSubject.dll");

            // Rewrite it (renaming the assembly and namespaces in the process)
            var generator = new AssemblyGenerator();
            generator.RenameForTesting("TestSubject", "ClonedTestSubject");
            generator.GenerateAssembly(_asmOriginal, clonedAssembly);

            _namespaceName = "ClonedTestSubject";
            _assembly      = clonedAssembly;

            _asmCloned = Assembly.LoadFrom(_assembly);
#endif
        }
Esempio n. 5
0
        static RewriteTest()
        {
            // Get the original assembly
            _asmOriginal = typeof(RewriteOriginal.MyClass).Assembly;
            var originalAssembly = _asmOriginal.Location;

            // Generate the cloned assembly
            // NB: putting it in the "cloned" sub directory prevents an
            //     issue with someone (VisStudio perhaps) having the file open
            //     and preventing rewrite on subsequent run.
            var outDir = Path.Join(Path.GetDirectoryName(originalAssembly), "cloned");

            Directory.CreateDirectory(outDir);
            var clonedAssembly = Path.Join(outDir, "RewriteClone.dll");

            // Rewrite it (renaming the assembly and namespaces in the process)
            var generator = new AssemblyGenerator();

            generator.RenameForTesting("RewriteOriginal", "RewriteClone");
            generator.GenerateAssembly(_asmOriginal, clonedAssembly);

            _namespaceName = "RewriteClone";
            _assembly      = clonedAssembly;

            // Uncomment these two lines to run with the original uncloned assembly
            // (handy to check if test case is wrong)
            //_namespaceName = "RewriteOriginal";
            //_assembly = originalAssembly;

            _asmCloned = Assembly.LoadFrom(_assembly);
        }
Esempio n. 6
0
        public void SaveTypeBuilder(TypeBuilder parentType, string fileName)
        {
            try
            {
                var basePath = Path.Combine(Directory.GetCurrentDirectory(), $"generated");

                if (!Directory.Exists(basePath))
                {
                    Directory.CreateDirectory(basePath);
                }

                fileName = $"{fileName}_{DateTime.Now:MMddyyyyhhmmss}";

                var generator = new AssemblyGenerator();
                generator.GenerateAssembly(_assemblyBuilder, Path.Combine($"{basePath}\\{fileName}.dll"));
            }
            catch (PlatformNotSupportedException ex)
            {
                // log and gracefully handled
                _logger.LogError(ex, "Current platform not supported to save dynamic code generation at runtime.");
            }
            catch (Exception e)
            {
                // log and gracefully handled
                _logger.LogError(e, "Error while saving dynamic context into disk.");
            }
        }
Esempio n. 7
0
        private static void SerializeAssembly(Assembly assembly, string fileName)
        {
            var path = GetPathForAssembly(fileName);

            var generator = new AssemblyGenerator();

            generator.GenerateAssembly(assembly, path);
        }
Esempio n. 8
0
        public static void EmitAssembly(AssemblyBuilder assy, string filename)
        {
#if NETSTANDARD
            var generator = new AssemblyGenerator();
            generator.GenerateAssembly(assy, filename);
#else
            assy.Save(filename);
#endif
        }
Esempio n. 9
0
        public static void EmitAssembly(AssemblyBuilder assy, string filename)
        {
#if NETSTANDARD
            Console.WriteLine("[emit] with Lokad.ILPack");
            var generator = new AssemblyGenerator();
            generator.GenerateAssembly(assy, filename);
#else
            Console.WriteLine("[emit] with SRE");
            assy.Save(filename);
#endif
        }
Esempio n. 10
0
        private static string SerializeAssembly(Assembly asm, string fileName)
        {
            var current = Directory.GetCurrentDirectory();
            var path    = Path.Combine(current, fileName);

            using (var generator = new AssemblyGenerator(asm))
            {
                generator.GenerateAssembly(path);
            }

            return(path);
        }
Esempio n. 11
0
        static void Main(string[] args)
        {
            var asm = Assembly.GetEntryAssembly();

            //var asm = Assembly.LoadFile(@"C:\Users\Nikolay\Documents\Visual Studio 2017\AssemblyGenerator.Example\bin\Debug\netcoreapp2.0\AssemblyGenerator.dll");
            //var asm = Assembly.LoadFile(@"C:\Users\Nikolay\Documents\Visual Studio 2017\Projects\AssemblyGenerator\src\AssemblyGenerator.Example\AssemblyGenerator.Example.dll");
            using (var generator = new AssemblyGenerator(asm))
            {
                generator.GenerateAssembly("output.dll");
            }
            //Console.WriteLine("READY!");
            //Console.ReadKey();
        }
        public void SetupContext()
        {
            Generator = new AssemblyGenerator();
            _scenarios = new IScenario[]
                             {
                                 TestHelper.BuildScenario("foo", "When I do seomthing",
                                                          "something else should happen")
                             };

            var spec = new AssemblyGenerationSpec {Assemblies = new[] {this.GetType().Assembly.Location}};
            spec.AddStory(new Story("foo", "bar", _scenarios), _scenarios);

            GeneratedAssemblyPath = Generator.GenerateAssembly(spec);
        }
Esempio n. 13
0
        public string GenerateCSharp()
        {
            string dllPath   = $"./fordebug.dll";
            var    generator = new AssemblyGenerator();

            generator.GenerateAssembly(Builder, dllPath);
            CSharpDecompiler decompiler = new CSharpDecompiler(dllPath, new ICSharpCode.Decompiler.DecompilerSettings());
            var          syntaxTree     = decompiler.DecompileWholeModuleAsSingleFile();
            StringWriter output         = new StringWriter();
            var          visitor        = new CSharpOutputVisitor(output, FormattingOptionsFactory.CreateSharpDevelop());

            syntaxTree.AcceptVisitor(visitor);
            return(output.ToString());
        }
Esempio n. 14
0
        static void Main(string[] args)
        {
            // var asm = Assembly.GetEntryAssembly();
            // var asm = Assembly.LoadFile(@"D:\X-Files\Projects\AssemblyGenerator\src\AssemblyGenerator.SampleAssembly\bin\Debug\netstandard2.0\AssemblyGenerator.SampleAssembly.dll");
            //var asm = Assembly.LoadFile(@"C:\Users\Nikolay\Documents\Visual Studio 2017\Projects\AssemblyGenerator\src\AssemblyGenerator.Example\AssemblyGenerator.Example.dll");
            var asm = SampleFactorialFromEmission.EmitAssembly(10);

            using (var generator = new AssemblyGenerator(asm))
            {
                generator.GenerateAssembly("output.dll");
            }
            //Console.WriteLine("READY!");
            //Console.ReadKey();
        }
Esempio n. 15
0
        public void SetupContext()
        {
            Generator  = new AssemblyGenerator();
            _scenarios = new IScenario[]
            {
                TestHelper.BuildScenario("foo", "When I do seomthing",
                                         "something else should happen")
            };

            var spec = new AssemblyGenerationSpec {
                Assemblies = new[] { this.GetType().Assembly.Location }
            };

            spec.AddStory(new Story("foo", "bar", _scenarios), _scenarios);

            GeneratedAssemblyPath = Generator.GenerateAssembly(spec);
        }
Esempio n. 16
0
        public override TemplateInfo CompileTemplate(string templateBody, Dictionary <string, Type> globalsTypes, List <Assembly> referencedAssemblies)
        {
            lock (_templateInfoCacheLock)
            {
                // Cache is empty, load templates from cache folder
                if (_templateInfoCache == null)
                {
                    _templateInfoCache = LoadTemplatesInfo(_templateCacheFolder);
                }

                // Generate template program
                TemplateInfo ti = GenerateTemplateProgram(templateBody, globalsTypes, referencedAssemblies);

                // Generated template found in cache
                if (_templateInfoCache.ContainsKey(ti.TemplateKey))
                {
                    return(_templateInfoCache[ti.TemplateKey]);
                }

                // Generate code
                ICodeGenerator codeGenerator = new CodeGenerator();
                ti.GeneratedSourceCode = codeGenerator.GenerateCode(ti);

                // Path to output assembly
                string assemblyFileName = _fileNamePattern.Replace("{key}", ti.TemplateKey);
                string assemblyPath     = Path.Combine(_templateCacheFolder, assemblyFileName);

                // Generate assembly
                var      assemblyCompiler = new AssemblyGenerator();
                Assembly assembly         = assemblyCompiler.GenerateAssembly(ti, false, assemblyPath, null);

                // Try to load the Render() method from assembly
                ti.RenderMethod = GetTemplateRenderMethod(assembly, ti);

                // Try to load the template generator version from assembly
                ti.GeneratorVersion = GetTemplateGeneratorVersion(assembly, ti);

                _templateInfoCache.Add(ti.TemplateKey, ti);

                return(ti);
            }
        }
Esempio n. 17
0
        async Task Run()
        {
            // Get the original assembly
            _asmOriginal = typeof(SandboxSubject.MyClass).Assembly;
            _asmCloned   = typeof(SandboxSubject.MyClass).Assembly;
            var originalAssembly = _asmOriginal.Location;


#if USE_ORIGINAL_SANDBOXSUBJECT
            _namespaceName = "SandboxSubject";
            _assembly      = originalAssembly;
#else
            // Generate the cloned assembly
            // NB: putting it in the "cloned" sub directory prevents an
            //     issue with someone (VisStudio perhaps) having the file open
            //     and preventing rewrite on subsequent run.
            var outDir = Path.Join(Path.GetDirectoryName(originalAssembly), "cloned");
            Directory.CreateDirectory(outDir);
            var clonedAssembly = Path.Join(outDir, "ClonedSandboxSubject.dll");

            // Rewrite it (renaming the assembly and namespaces in the process)
            var generator = new AssemblyGenerator();
            generator.RenameForTesting("SandboxSubject", "ClonedSandboxSubject");
            generator.GenerateAssembly(_asmOriginal, clonedAssembly);

            _namespaceName = "ClonedSandboxSubject";
            _assembly      = clonedAssembly;

            _asmCloned = Assembly.LoadFrom(_assembly);
#endif


            // Invoke the cloned assembly...

            var result = await Invoke(
                $"var r = x.Test();",
                "r"
                );

            Console.WriteLine(result);
        }
Esempio n. 18
0
        private void Build(StartupArgumentInfo argumentInfo, string[] args)
        {
            if (!Program.HasTarget)
            {
                Logger.Log(LogType.Log, "You need to specify a target config");
                return;
            }

            AssemblyDefinition def = AssemblyDefinition.Load(Program.Target);

            AssemblyGeneratorBuildType buildType = AssemblyGeneratorBuildType.Publish;

            if (args.Length == 1 && !Enum.TryParse(args[0], out buildType))
            {
                Logger.Log(LogType.Log, "Can not parse the BuildType. Using Default:" + buildType);
            }

            string path = Path.Combine(Path.GetDirectoryName(Program.Target), $"{def.AssemblyName}_build");

            Logger.Log(LogType.Log, "AAAAAAAAAAAAAA:" + path);
            AssemblyGenerator.GenerateAssembly("dotnet", def, path, buildType, !Program.BuildConsole);
        }
        public void ReadAssembly()
        {
            if (!File.Exists(path))
            {
                throw new Exception(String.Format("File {0} not exists!", this.path));
            }
            AppDomain    myDomain  = Thread.GetDomain();
            AssemblyName myAsmName = new AssemblyName();

            myAsmName.Name = Path.GetFileNameWithoutExtension(path) + ".proxy.dll";

            AssemblyBuilder myAsmBuilder = AssemblyBuilder.DefineDynamicAssembly(myAsmName, AssemblyBuilderAccess.Run);
            // Generate a persistable single-module assembly.
            ModuleBuilder myModBuilder =
                myAsmBuilder.DefineDynamicModule(myAsmName.Name + ".dll");

            using (var dynamicContext = new AssemblyResolver(path))
            {
                List <Assembly>         refsAsm          = new List <Assembly>();
                List <Type>             EntityTypes      = new List <Type>();
                List <DBContextContent> DBContextClasses = new List <DBContextContent>();
                var dynAssembly = dynamicContext.Assembly;
                var aTypes      = dynAssembly.GetTypes();

                foreach (var t in aTypes)
                {
                    if (IsDBContextType(t))
                    {
                        string ClassName            = String.IsNullOrWhiteSpace(t.Namespace) ? "" : t.Namespace + "." + t.Name;
                        var    createdTypeDBContext = myModBuilder.DefineType(ClassName, TypeAttributes.Class | TypeAttributes.Public);

                        var DBContextClass = new DBContextContent();
                        DBContextClass.ClassName = ClassName;
                        DBContextClasses.Add(DBContextClass);
                        createdTypeDBContext.SetParent(t.BaseType);
                        // copy constructor && methods
                        var dbContextConstructors = t.GetConstructors(BindingFlags.DeclaredOnly);
                        foreach (var cI in dbContextConstructors)
                        {
                            MethodAttributes visibility = cI.IsStatic ? MethodAttributes.Static : MethodAttributes.Public;
                            var cBuilder = createdTypeDBContext.DefineConstructor(visibility, CallingConventions.Standard, null);
                            foreach (var cParams in cI.GetParameters())
                            {
                                var cP = cBuilder.DefineParameter(cParams.Position, Helper.GetParamAttributesFromParamInfo(cParams), cParams.Name);
                                cP.SetConstant(cParams.DefaultValue);
                                Helper.TransferAttributes(cP, cParams, refsAsm);
                            }
                        }
                        var dbContextMethods = t.GetMethods(BindingFlags.DeclaredOnly);
                        foreach (var cI in dbContextMethods)
                        {
                            MethodAttributes visibility = cI.IsStatic ? MethodAttributes.Static : MethodAttributes.Public;
                            var cBuilder = createdTypeDBContext.DefineMethod(cI.Name, visibility);
                            foreach (var cParams in cI.GetParameters())
                            {
                                var cP = cBuilder.DefineParameter(cParams.Position, Helper.GetParamAttributesFromParamInfo(cParams), cParams.Name);
                                cP.SetConstant(cParams.DefaultValue);
                                Helper.TransferAttributes(cP, cParams, refsAsm);
                            }
                        }
                        DBContextClass.TypeBuilder = createdTypeDBContext;
                        // - copy constructor & methods
                        PropertyInfo[] props = t.GetProperties();
                        foreach (var dbContextMember in props)
                        {
                            Type   cType = dbContextMember.PropertyType;
                            Type[] gArgs = cType.GenericTypeArguments;
                            if (cType != null && cType.IsGenericType && cType.FullName.StartsWith("Microsoft.EntityFrameworkCore.DbSet") && gArgs.Length > 0)
                            {
                                if (EntityTypes.Find(v => (v != null && v.FullName == gArgs[0].FullName)) == null)
                                {
                                    EntityTypes.Add(gArgs[0]);
                                    EntityDescribtion eDescr = new EntityDescribtion();
                                    eDescr.EntityType = gArgs[0];
                                    eDescr.PropName   = dbContextMember.Name;
                                    //eDescr.OriginalPropType = cType.ReflectedType.BaseType;
                                    DBContextClass.Content.Add(eDescr);
                                }
                            }
                        }
                        foreach (var entityType in EntityTypes)
                        {
                            string entityClassName     = String.IsNullOrWhiteSpace(entityType.Namespace) ? "" : entityType.Namespace + "." + entityType.Name;
                            var    createdType         = myModBuilder.DefineType(entityClassName, TypeAttributes.Class | TypeAttributes.Public);
                            var    propsFlattern       = Helper.GetAllProps(entityType); //GetAllProps(entityType);
                            var    allEntityAttributes = Helper.GetTypeAttributes(entityType);

                            foreach (var atr in allEntityAttributes) // entity attributes
                            {
                                var      classAtributes = atr.AttributeType.GetCustomAttributesData();
                                object[] atribArgs      = new object[classAtributes.Count];
                                for (var i = 0; i < classAtributes.Count; i++)
                                {
                                    atribArgs[i] = classAtributes[i];
                                    var atrType = classAtributes[i].AttributeType;
                                    Helper.ChekReferences(refsAsm, atrType.Assembly);
                                }
                                var      atrArgs = atr.ConstructorArguments.ToArray();
                                object[] cArgs   = new object[atrArgs.Count()];
                                for (int i = 0; i < atrArgs.Count(); i++)
                                {
                                    cArgs[i] = (object)atrArgs[i];
                                }
                                var cTors = atr.AttributeType.GetConstructors();
                                var constructorForAttribute = cTors.FirstOrDefault(v => v.GetParameters().Count() == atrArgs.Count());
                                try
                                {
                                    CustomAttributeBuilder cA = new CustomAttributeBuilder(constructorForAttribute, cArgs);
                                    createdType.SetCustomAttribute(cA);
                                }
                                catch (Exception e)
                                {
                                    //
                                }
                                // some actions when attribute is present!
                                var memberAttributes = atr.AttributeType.GetMethods();
                                foreach (var mA in memberAttributes.Where(v => v.Name == "Apply"))
                                {
                                    var args = new object[] { entityType, AttributeTargets.Class, myModBuilder, refsAsm };
                                    var createdTypeInAttribute = mA.Invoke(null, args);
                                    if ((Type)createdTypeInAttribute != null)
                                    {
                                        EntityDescribtion eDescrGenereted = new EntityDescribtion();
                                        eDescrGenereted.EntityType = (Type)createdTypeInAttribute;
                                        eDescrGenereted.PropName   = eDescrGenereted.EntityType.Name;
                                        eDescrGenereted.PropType   = (Type)createdTypeInAttribute;
                                        //eDescrGenereted.PropType = (Type)createdTypeInAttribute;
                                        DBContextClass.Content.Add(eDescrGenereted);
                                    }
                                }
                            }
                            foreach (var cProp in propsFlattern)
                            {
                                Helper.AddGetSetMethodsForProperty(cProp, createdType, refsAsm);
                            }
                            var dbContextType = createdType.CreateType();
                            var eDescr        = DBContextClass.Content.First(e => e.EntityType == entityType);
                            if (eDescr != null)
                            {
                                eDescr.PropType = dbContextType; // generetad type
                            }
                        }
                    }
                }
                foreach (var cont in DBContextClasses)
                {
                    var tb = cont.TypeBuilder;
                    foreach (var contProps in cont.Content)
                    {
                        var tp         = contProps.EntityType;
                        var tDBSet     = typeof(Microsoft.EntityFrameworkCore.DbSet <>);
                        var tDBsetType = tDBSet.MakeGenericType(contProps.PropType);
                        if (refsAsm.FindIndex(v => v.FullName == tDBsetType.Assembly.FullName) == -1)
                        {
                            var asm = new AssemblyResolver(tDBsetType.Assembly.Location);
                            refsAsm.Add(tDBSet.Assembly);
                        }
                        Helper.AddGetSetMethodsForProperty(contProps.PropName, tDBsetType, tb);
                    }
                    tb.CreateType();
                }
                var generator = new AssemblyGenerator();
                generator.GenerateAssembly(myAsmBuilder, refsAsm, output);
            }
        }
        public override TemplateInfo CompileTemplate(string templateBody, Dictionary<string, Type> globalsTypes, List<Assembly> referencedAssemblies)
        {
            lock (_templateInfoCacheLock)
            {
                // Cache is empty, load templates from cache folder
                if (_templateInfoCache == null)
                {
                    _templateInfoCache = LoadTemplatesInfo(_templateCacheFolder);
                }

                // Generate template program
                TemplateInfo ti = GenerateTemplateProgram(templateBody, globalsTypes, referencedAssemblies);

                // Generated template found in cache
                if (_templateInfoCache.ContainsKey(ti.TemplateKey))
                {
                    return _templateInfoCache[ti.TemplateKey];
                }

                // Generate code
                ICodeGenerator codeGenerator = new CodeGenerator();
                ti.GeneratedSourceCode = codeGenerator.GenerateCode(ti);

                // Path to output assembly
                string assemblyFileName = _fileNamePattern.Replace("{key}", ti.TemplateKey);
                string assemblyPath = Path.Combine(_templateCacheFolder, assemblyFileName);

                // Generate assembly
                var assemblyCompiler = new AssemblyGenerator();
                Assembly assembly = assemblyCompiler.GenerateAssembly(ti, false, assemblyPath, null);

                // Try to load the Render() method from assembly
                ti.RenderMethod = GetTemplateRenderMethod(assembly, ti);

                // Try to load the template generator version from assembly
                ti.GeneratorVersion = GetTemplateGeneratorVersion(assembly, ti);

                _templateInfoCache.Add(ti.TemplateKey, ti);

                return ti;
            }
        }
Esempio n. 21
0
 private static void AssemblyGeneratorBuildTest(AssemblyDefinition defs)
 {
     AssemblyGenerator.GenerateAssembly(MSBUILD_PATH, defs, $".\\{defs.AssemblyName}_Build\\",
                                        AssemblyGeneratorBuildType.Publish, true);
 }