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

nulldata
by nulldata · 4 posts
6 years ago in .Net (C#, VB, etc)
Posted 6 years ago · Author
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
Posted 6 years ago · Author
@DataMine
I got it downloaded but am clueless on how to actually use it
Posted 6 years ago
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