4

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.

Swanand
  • 4,027
  • 10
  • 41
  • 69

4 Answers4

12

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.

Joe Daley
  • 45,356
  • 15
  • 65
  • 64
  • Only answer that directly addresses the problem - doesn't explain what the problem is though (-: – Murph Oct 22 '10 at 07:11
  • @Murph: Attempted an explanation – Joe Daley Oct 22 '10 at 07:39
  • This solution can work for any application which has this problem.... So I have edited the Title of Post.... Great!! Thanks a lot!! Now I don’t have to supply DLLs….. – Swanand Oct 22 '10 at 08:26
2

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.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
1

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.

Adrian Fâciu
  • 12,414
  • 3
  • 53
  • 68
0

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

Aykut Çevik
  • 2,060
  • 3
  • 20
  • 27
  • true, this is possible. But it's better to use ILMerge or some other merging or embedding mechanism. – Cheeso Nov 08 '10 at 02:54