How Do I Embed A .dll To My .exe [HELP] 4 posts

OP Tue Oct 30, 2018 1:48 am
User avatar
Social Engineer
Lower Family Member
  • Posts: 152
  • Joined: Jan, 2017
  • Karma: 21
just finished a program and I would like to make it just one file so its easy to hand out and not have extra files just laying around. I made a program using a framework that needs a .dll to be in the same location as the .exe. Could someone help on how i can embed it to make it just 1 file?


I tried to use the (Package Manager Console) with "install-package costura.fody"
and that didn't seam to work then i tried (ilmerge) and that wasn't working also.

Made with: vb.NET

Image
Tue Oct 30, 2018 2:32 am
User avatar
Administrator
Legendary Family Member
  • Gender: Male
  • Posts: 6284
  • Joined: Jun, 2010
  • Advertisements: 45
  • Karma: 368
Did you try LibZ I linked you to?
OP Tue Oct 30, 2018 3:04 am
User avatar
Social Engineer
Lower Family Member
  • Posts: 152
  • Joined: Jan, 2017
  • Karma: 21
@DataMine
I got it downloaded but am clueless on how to actually use it
Tue Oct 30, 2018 9:59 pm
User avatar
Administrator
Legendary Family Member
  • Gender: Male
  • Posts: 6284
  • Joined: Jun, 2010
  • Advertisements: 45
  • Karma: 368
Did you download an executable? If so just create a batch script to automate it:


LibZ Compressor.bat
Code
REM This script automates the LibZ compression process
REM It automatically builds the LibZ command with exe and dll file names

@echo off

::Delayed Expansion will cause variables to be expanded at execution time rather than at parse time
setlocal enabledelayedexpansion

::Path to the LibZ executable
set LibZpath="PATH TO LIBZ\libz.exe"

::Declare variable to hold the path of the program
set exepath=

::Declare variable to hold the name of the program
set exename=

::Declar variable to hold the names of the dlls
set dlls=

::Iterate over current directory and grab the exe name and path
for /r %%i in (*.exe) do (
   set exepath="%%i"
   set exename=%%~nxi
)

::Iterate over the current directory and grab names of the dlls wrapping them in quotes
for /r %%i in (*.dll) do set dlls=!dlls! "%%i"

::Execute the LibZ command plugging in the current directory, exe and dll names
::%LibZpath% inject-dll --assembly %exepath% --include %dlls% --move
%LibZpath% inject-dll --assembly %exepath% --include *.dll --move

pause

Create an account or sign in to comment

You need to be a member in order to leave a comment

Sign in

Already have an account? Sign in here

SIGN IN NOW

Create an account

Sign up for a new account in our community. It's easy!

REGISTER A NEW ACCOUNT