How to compress files in .NET 1.1
-
03-07-2019 - |
Question
I need to compress files in [*.zip] format in .NET 1.1. I don't want to use SharpZip for compression as I got random errors - "Access Denied" - when running it in .NET 1.1.
SharptZip will work properly only if I put the assembly on the GAC - which is not an option in my project. This is the problem. Check this: http://forums.asp.net/p/1139901/1839049.aspx#1839049
Solution
You can use a command-line tool for zip. For example 7-Zip.
OTHER TIPS
You could grab the zlib dll and use .NET interop to call the compression functions (if i remember correctly, you could get away with just 2 calls, one for library initialization and one to compress the data). Beware that you'll run problems on 64-bit architectures if you use a 32-bit zlib dll and vice versa.
You need to upgrade! .NET 1.1 is 6 years old now!
If you have the option of using J#.Net libraries you should be able to use java zip api included in it.
Here is a sample code.