- The most obvious step is to put all your dll files inside your application. To do that, create a folder called "Libraries" on your project and drag all the dll files inside that folder.
- Once you have all your dll files inside the folder, highlight all of them, right-click, then click Properties. At the property menu, change the "Build Action" to "Embedded Resource" and the "Copy to Output Directory" to "Do not Copy".
- What you need now is a little code magic. Go to your "Startup" program (in WPF, it's the APP.xaml) and add the following code below:
- Find that code that says' "[YourAssemblyName]" and replace that with your Assembly Name. If you don't know where to find your Assembly Name, go to 'Projects => ...Properties => Application' then you will see your Assembly Name.
- Try to run the program without the DLL and see if it works.
Thursday, June 12, 2014
C# - Embedding All DLL into a single EXE
DLL files gets ugly once it takes over the whole application folder. Fortunately, with just a few set of codes, your dll files can be embedded inside the application though this may make the application's (.exe) filesize looks big in the eye of the end user. Are you ready? Then the steps below.
Subscribe to:
Posts (Atom)