示例#1
0
        public Assembly GetAssembly()
        {
            if (Compiler.AssemblyName == default)
            {
                Compiler.AssemblyName = Guid.NewGuid().ToString("N");
            }


            //如果是文件编译,则初始化路径
            if (Compiler.AssemblyOutputKind == Framework.AssemblyBuildKind.File)
            {
                if (OutputFolder == GlobalOutputFolder)
                {
                    OutputFolder = Path.Combine(GlobalOutputFolder, Compiler.Domain.Name);
                }
                if (!Directory.Exists(OutputFolder))
                {
                    Directory.CreateDirectory(OutputFolder);
                }
                if (Compiler.DllPath == default)
                {
                    Compiler.DllPath = Path.Combine(OutputFolder, Compiler.AssemblyName + ".dll");
                    Compiler.PdbPath = Path.Combine(OutputFolder, Compiler.AssemblyName + ".pdb");
                }
            }


            //进入编译流程
            Compile();


            //如果编译出错
            if (Compiler.Assembly == null && Exceptions != null && Exceptions.Count > 0)
            {
                switch (Compiler.ErrorBehavior)
                {
                case ExceptionBehavior.Log | ExceptionBehavior.Throw:
                    LogOperator.ErrorRecoder(Compiler.Compilation, Exceptions);
                    throw Exceptions[0];

                case ExceptionBehavior.Log:
                    LogOperator.ErrorRecoder(Compiler.Compilation, Exceptions);
                    break;

                case ExceptionBehavior.Throw:
                    throw Exceptions[0];

                default:
                    break;
                }
            }
            else
            {
                LogOperator.SucceedRecoder(Compiler.Compilation);
            }
            return(Compiler.Assembly);
        }
示例#2
0
        public Assembly GetAssembly()
        {
            //如果是文件编译,则初始化路径
            if (Compiler.AssemblyOutputKind == Framework.AssemblyBuildKind.File)
            {
                if (Compiler.DllPath == default)
                {
                    Compiler.DllPath = Path.Combine(OutputFolder, Compiler.AssemblyName, ".dll");
                    Compiler.PdbPath = Path.Combine(OutputFolder, Compiler.AssemblyName, ".pdb");
                }
            }


            //进入编译流程
            Compile();


            //如果编译出错
            if (Compiler.Assembly == null && Exceptions != null && Exceptions.Count > 0)
            {
                switch (Compiler.ErrorBehavior)
                {
                case ExceptionBehavior.Log | ExceptionBehavior.Throw:
                    LogOperator.ErrorRecoder(Compiler.Compilation, Exceptions);
                    throw Exceptions[0];

                case ExceptionBehavior.Log:
                    LogOperator.ErrorRecoder(Compiler.Compilation, Exceptions);
                    break;

                case ExceptionBehavior.Throw:
                    throw Exceptions[0];

                default:
                    break;
                }
            }
            else
            {
                LogOperator.SucceedRecoder(Compiler.Compilation);
            }
            return(Compiler.Assembly);
        }