Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

>> Merge DLL | Use DLL from Ressources | Remove Depencies | No ILMerge! <<

Merge DLL's

I think, many people often asked this question theirself: "How can I merge my DLL with my exe, so I can use a standalone exe file without needing the DLL file in the same folder etc...
I had the same problem just a few hours ago, and found a solution which works pretty awesome! :)

Well, this method which works like a charm.
I'll show you this in a small little tutorial :)
First we will create our own little DLL

Part 1 - Create a DLL File

So start by launching Visual Basic and create a new Project. Choose Class Library to create a new DLL file.
You get Something like this:

Code
Public Class Class1

End Class

Change the Class1 to any name you like. This will be our DLL name when using the DLL in a project.
I call it TestDLL. So it should now look similar to this:

[img]http://s1.directupload.net/images/130919/we2ves46.png[/img]

Now we create to little functions, so our DLL can do some stuff.
First, I create a Public Function which returns the computername, and second I create a Public Function which returns the Operating System name. Of course you can add whatever you like your DLL be able to do. You can also just use other .Net DLLs, downloaded from the web.
This should now look like this:

[img]http://s7.directupload.net/images/130919/jhyxlul6.png[/img]

Then compile the DLL. It will now created inside the Debug folder of your project.

Part 2 - Create Main Application

Now we are going to create our Main program which requires the DLL file. We will remove the Depencies from this Application and merge the DLL and the executable together.
But calm down and go step by step ^^
So, Start by creating a new Windows Form Application.
Just add Two Buttons and Title one of the "Computername" and the second one "Operating System".
This should now look like this:

[img]http://s1.directupload.net/images/130919/nof37tvc.png[/img]

Now go to Project >> Add Reference and search our TestDLL.dll on your computer. Then you add it as reference.
Till now its just like we use it normally.
Now type at the top of your Code:

Code
Imports TestDLL

Now below the Public Class Form1 we are going to type:

Code
Dim MyDLL As New TestDLL.TestDLL

Now just doubleclick the first and second button and call the functions of the dll file:

[img]http://s7.directupload.net/images/130919/n6zw7hpn.png[/img]

Part 3 - Add DLL as Ressource and merge it with Main Application

Now we are going to do the most important part. We remove the depencies by merging the DLL with the Main Application as a Ressource File.
Go To My Project in The Project Explorer.

Go to the Ressource Tab.
Add your TestDLL.dll as a ressource file.

Now go to the Application Tab and Click on Application Events.
You will get something like this (in your native language of course):

[img]http://s14.directupload.net/images/130919/n9hzhur3.png[/img]

Now inside the Partial Friiend Class MyApplication you are going to paste this code:

Code
Partial Friend Class MyApplication
  Private WithEvents DLLDomain As AppDomain = AppDomain.CurrentDomain
  Private Function DLL_AssemblyResolve(ByVal sender As Object, ByVal args As System.ResolveEventArgs) As System.Reflection.Assembly Handles DLLDomain.AssemblyResolve
    If args.Name.Contains("TestDLL") Then
    Return System.Reflection.Assembly.Load(My.Resources.TestDLL)
    Else
    Return Nothing
    End If
  End Function
    End Class

You basiclly paste the name of TestDLL (or whatever DLL you like to merge) without the .dll at the end in the right places.
After this is done, you are finished with this, we are done!!

Compile your Application and you can use it as a standalone exe file.
You don't need the DLL file to be with your App.
Whenever you use it, the App will automaticlly use it from the ressources without extracting it.
This can be used for Rat Servers if they need DLL's or just If you are to lazy to get two files.
Everything compact in one executable!!

This will only work with .net DLL's.
C++ DLL's are not working with this method!

I hope u liked the Tutorial :)

I like ur Tuts and such my friend keep it up :) <3
Thanks, I am glad u like this.
Its pretty useful when creating RAT's, Keyloggers which require some DLL's to work.
So you can give only one .exe file and there is no need to bring the .DLL file always with you :)
WoW, you always impress me man, congrats.
Nice tutorials as always, keep upp the good works bro ;-) - Allan
Great tutorial keep up the great work bro :)
Thank you guys for commenting. I am glad this tutorial has helped you:)
Nice TUT man, With this basics is easy to introduce to "hard" and advanced things.
I am glad you liked it. I hope you can use it :)
Thank for good tutorial! Thats useful thing. Il give you credits :)
Another very good tutorial, thank you very much ;)
null
Thanks dude very usefully !!!! i have search this for 3 month :D
(Dec 27, 2013 10:06 PM)HskCool78 Wrote:  Thanks dude very usefully !!!! i have search this for 3 month :D
3 months... really dude? O_o
Well then enjoy :)
(Dec 27, 2013 10:06 PM)HskCool78 Wrote:  Thanks dude very usefully !!!! i have search this for 3 month :D

lol i just released the same 2 years ago. but i used the title "integrate dll"
Again another great Tutorial from you ! :D


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by SмℯґƒFeb 22, 2020 11:53 PM 1 103 Feb 22, 2020 11:53 PM
Last Post: SIM-3991524
[C] by SecurifierJan 17, 2020 07:20 AM 12 416 Jan 17, 2020 07:20 AM
Last Post: SIM-3602340
[C] by SIM-3437924Oct 1, 2019 10:49 AM 1 161 Oct 1, 2019 10:49 AM
Last Post: myselfandi