Pergunta

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.

Foi útil?

Solução

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.

Outras dicas

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.

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.

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top