使用ILmerge合并Exe、Dll文件的帮助类

http://blog.csdn.net/pukuimin1226/article/details/7841741

 

    using System;  
    using System.Collections.Generic;  
    using System.Text;  
    using System.IO;  
      
    namespace Tools  
    {  
        /// <summary>  
        /// 使用ILmerge合并Exe、Dll文件的帮助类  
        /// </summary>  
        public class ILmerge  
        {  
            /// <summary>  
            /// 得到合并Exe、Dll文件的ILmerge语句  
            /// </summary>  
            /// <param name="DllPath">Dll文件目录</param>  
            /// <param name="SourceExeFile">原exe文件全路径</param>  
            /// <param name="TargetExeFile">要生成的exe文件全路径</param>  
            /// <returns></returns>  
            public static string GetMergeExeCmd(string DllPath,string SourceExeFile,string TargetExeFile)  
            {  
                StringBuilder sb = new StringBuilder();  
                sb.Append("ILmerge /ndebug /target:winexe /out:");  
                sb.Append(TargetExeFile);  
                sb.Append(" /log ");  
                sb.Append(SourceExeFile);  
                string []dllFiles = Directory.GetFiles(@DllPath,"*.dll");  
                foreach (string dllFile in dllFiles)  
                {  
                    sb.Append(" " + dllFile);  
                }  
                return sb.ToString();  
            }  
            /// <summary>  
            /// 得到合并Dll文件的ILmerge语句  
            /// </summary>  
            /// <param name="DllPath">Dll文件目录</param>  
            /// <param name="TargetDllFile">要生成的Dll文件全路径</param>  
            /// <returns></returns>  
            public static string GetMergeDllCmd(string DllPath, string TargetDllFile)  
            {  
                StringBuilder sb = new StringBuilder();  
                sb.Append("ILmerge /ndebug /target:dll /out:");  
                sb.Append(TargetDllFile);  
                sb.Append(" /log ");  
                string[] dllFiles = Directory.GetFiles(@DllPath,"*.dll");  
                foreach (string dllFile in dllFiles)  
                {  
                    sb.Append(" " + dllFile);  
                }  
                return sb.ToString();  
            }  
        }  
    }  

 

 

posted @ 2013-03-13 21:07  shiningrise  阅读(236)  评论(0编辑  收藏  举报
// 侧边栏目录 // https://blog-static.cnblogs.com/files/douzujun/marvin.nav.my1502.css