Пример #1
0
        /// <summary>编译运行</summary>
        /// <returns></returns>
        public Assembly Compile()
        {
            if (Status >= TemplateStatus.Compile)
            {
                return(Assembly);
            }

            if (Status < TemplateStatus.Process)
            {
                Process();
            }

            if (References != null)
            {
                AssemblyReferences.AddRange(References);
            }

            String name = AssemblyName;

            if (String.IsNullOrEmpty(Path.GetExtension(name)))
            {
                name += ".dll";
            }
            Assembly asm = Compile(name, AssemblyReferences, Provider, Errors, this);

            if (asm != null)
            {
                Assembly = asm;
            }

            // 释放提供者
            Provider = null;

            Status = TemplateStatus.Compile;

            return(asm);
        }