Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove DLL dependency for an Application

In my application, I need to Zip and Unzip some files. For that I have used DotNet Zip Library (Ionic.Zip.dll-- DotNet Zip Lib )

Everything works fine but when I take EXE of my file and try to run it from different folder, it fails to run. I have to keep Ionic.Zip.dll in the folder where my application resides. Is there any way out? I just want an EXE file without any strings attached.... Or is there any other option other than DotNet Zip Lib.

like image 258
Swanand Avatar asked Dec 08 '22 01:12

Swanand


1 Answers

When you add a reference to another assembly (e.g. a third-party DLL) to your C# project, the compiler doesn't add the contents of that assembly into your EXE; it just creates a link that says your program will need to load that DLL when it runs. It's quite normal to distribute a .NET program as an EXE file plus the DLL files that it needs.

But if you'd prefer, you can combine them into one EXE file. There are a few different tools that can merge multiple .NET assemblies into one. Have a look at ILMerge or .NETZ.

like image 186
Joe Daley Avatar answered Dec 09 '22 15:12

Joe Daley