Öncelikle Birleştirilecek Olan dll Dosyası Projeye Ekleyelim
Ardından Build Action = Embedded Resource Şeklinde İşaretleyelim
Program.cs Dosyasını Aşağıdaki Gibi Düzenleyelim.
using System; using System.Collections.Generic; using System.Windows.Forms; using System.Reflection; namespace exe_dll_birleştir { static class Program { /// /// The main entry point for the application. /// [STAThread] static void Main() { AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) { String resourceName = "exe_dll_birleştir." + new AssemblyName(args.Name).Name + ".dll"; using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName)) { Byte[] assemblyData = new Byte[stream.Length]; stream.Read(assemblyData, 0, assemblyData.Length); return Assembly.Load(assemblyData); } } } }
YORUM YAPMAK İSTER MİSİN?