Example #1
0
 private void SaveBinary()
 {
     if (!this.projectContext.CompileResult.HasError())
     {
         string binFileName = projectContext.GetBinaryNameEx();
         projectContext.EmitContext.AssemblyBuilder.Save(binFileName);
         CompileUtil.MoveBinary(projectContext);
         CompileUtil.DeletePDB(projectContext);
         string exBinFileName  = projectContext.GetBinaryNameEx();
         string toFileFullPath = Path.Combine(projectContext.ProjectModel.BinarySaveDirectoryInfo.FullName, exBinFileName);
     }
 }
Example #2
0
        public static void GenerateBinary(ContextProject context)
        {
            string binFileName        = context.GetBinaryNameEx();
            string projectPackageName = context.ProjectModel.ProjectPackageName;

            //var assemblyName = new AssemblyName(projectPackageName);
            //AssemblyBuilder assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.RunAndSave);
            //var moduleBuilder = assemblyBuilder.DefineDynamicModule(projectPackageName, binFileName, true);
            //context.EmitContext.AssemblyName = assemblyName;
            //context.EmitContext.AssemblyBuilder = assemblyBuilder;
            //context.EmitContext.ModuleBuilder = moduleBuilder;

            context.CreateProjectEmitContext(AppDomain.CurrentDomain, projectPackageName, projectPackageName, binFileName);
            setAttr(context.EmitContext.AssemblyBuilder, context);
        }
Example #3
0
        public static void MoveBinary(ContextProject projectContext)
        {
            string exBinFileName    = projectContext.GetBinaryNameEx();
            string fromFileFullPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, exBinFileName);
            string toFileFullPath   = Path.Combine(projectContext.ProjectModel.BinarySaveDirectoryInfo.FullName, exBinFileName);

            if (File.Exists(toFileFullPath))
            {
                File.Delete(toFileFullPath);
            }
            if (File.Exists(fromFileFullPath) && fromFileFullPath != toFileFullPath)
            {
                File.Move(fromFileFullPath, toFileFullPath);
                File.Delete(fromFileFullPath);
            }
            CompileUtil.DeletePDB(projectContext);
        }