views:

68

answers:

4

Hey!

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.

+12  A: 

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
Only answer that directly addresses the problem - doesn't explain what the problem is though (-:
Murph
@Murph: Attempted an explanation
Joe Daley
@Joe - that works, I only get one upvote though (-:
Murph
Thanks a lot.... .NETZ is great utility!!
Swanand Purankar
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 Purankar
A: 

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

cevik
+1  A: 

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 Faciu
But I guess, gzip and Normal Zip files are different.
Swanand Purankar
@Swanand Purankar - Packaging namespace methods use zip format. Have a look at http://msdn.microsoft.com/en-us/library/system.io.packaging.zippackage.aspx
Adrian Faciu
+1  A: 

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