Swanand
Swanand

Reputation: 4115

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.

Upvotes: 4

Views: 4470

Answers (4)

Joe Daley
Joe Daley

Reputation: 46466

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.

Upvotes: 12

marc_s
marc_s

Reputation: 754953

Have a look at this pure C# libraries without external dependencies:

It can be included into your application and compiled directly into your single EXE - no external ZIP libraries needed.

Upvotes: 2

Adrian Fâciu
Adrian Fâciu

Reputation: 12552

You can use .net for that, have a look at Packaging namespace or if you can use gzip format you gave a class for that too. Using this you'll remove the dependency from your project.

Upvotes: 1

Aykut Çevik
Aykut Çevik

Reputation: 2088

If it is an opensource project, you can just include the source code in your project without adding a reference to the "dll".

Upvotes: 0

Related Questions