Is it possible to embed icsharpcode.sharpziplib.dll and use from a resource without extracting?

I have found some code to extract a .zip file using icsharpcode.sharpziplib.dll.  The Zip file is a resource and I pass icsharpcode the memorystream.  This makes it so I don't have to extract my zip to the HD first and then extract.  However, when I pass along my .exe file, it fails because it can't find the icsharpcode.sharpziplib.dll.

Is it possible to include this as a resource also and reference a resource instead of the file on the Hard drive?

I am new to the .NET environment, please be descriptive, I am learning.  If you see something I am doing that is dumb, let me know, I won't be offended, I want to learn better ways.

CURRENT SOLUTION (looking for embedded way): Include icsharpcode.sharpziplib.dll as resource, extract to hard drive when running program.
using ICSharpCode.SharpZipLib.Zip;
using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
using ICSharpCode.SharpZipLib.GZip;
 
        private void btnInstall_Click(object sender, EventArgs e)
        {
                ExtractFiles("ZipResourceName", txtDestination.Text, pbExtract);
        }
 
        //http://www.codeproject.com/KB/cs/ResourceManager_Class.aspx?display=Print
        private void ExtractFiles(String ZipFileName, String Destination, ProgressBar PB)
        {
            try
            {
                ResourceManager objResMgr = new ResourceManager("Namespace.ResourceFileName", Assembly.GetExecutingAssembly());
 
                byte[] objData = (byte[])objResMgr.GetObject(ZipFileName);
 
                MemoryStream objMS = new MemoryStream(objData);
                ZipInputStream objZIP = new ZipInputStream(objMS);
                ZipEntry theEntry;
                PB.Value = 0;
                PB.Step = 1;
 
                PB.Maximum = ZipFileCount(ZipFileName, Destination);
                String strAppDir = Destination;
 
                while ((theEntry = objZIP.GetNextEntry()) != null)
                {
                    String strPath = Path.GetDirectoryName(Path.Combine(strAppDir, theEntry.Name));
                    PB.PerformStep();
 
                    if (!Directory.Exists(strPath))
                    {
                        Directory.CreateDirectory(strPath);
                    }
 
 
                    if (Path.GetFileName(theEntry.Name) != "")
                    {
                        lblStatus.Text = "Extracting " + theEntry.Name;
                        FileStream streamWriter = File.Create(Path.Combine(strAppDir, theEntry.Name));
 
                        Application.DoEvents();
 
                        int size = objData.Length;
                        byte[] data = new byte[size];
                        while (true)
                        {
                            size = objZIP.Read(data, 0, data.Length);
                            if (size > 0)
                            {
                                streamWriter.Write(data, 0, size);
                            }
                            else
                            {
                                break;
                            }
                        }
                        streamWriter.Close();
                    }
                }
 
                objZIP.Close();
                lblStatus.Text = "Finished";
                PB.Value = PB.Maximum;
            }
 
            catch (MissingManifestResourceException ex)
            {
                lblStatus.Text = "Error: " + ex.Message;
                PB.Value = 0;
            }
            catch (Exception e1)
            {
                lblStatus.Text = "Error: " + e1.Message;
                PB.Value = 0;
            }
        }
 
        private int ZipFileCount(String ZipFileName, String Destination)
        {
            int count = 0;
            try
            {
                ResourceManager objResMgr = new ResourceManager("PPMInstaller.ResourcePPM", Assembly.GetExecutingAssembly());
                byte[] objData = (byte[])objResMgr.GetObject(ZipFileName);
 
                MemoryStream objMS = new MemoryStream(objData);
                ZipInputStream objZIP = new ZipInputStream(objMS);
                ZipEntry theEntry;
                String strAppDir = Destination;
 
                while ((theEntry = objZIP.GetNextEntry()) != null)
                {
                    count = count + 1;
                }
 
                objZIP.Close();
            }
 
            catch (MissingManifestResourceException ex)
            {
                lblStatus.Text = "Error: " + ex.Message;
            }
            catch (Exception e1)
            {
                lblStatus.Text = "Error: " + e1.Message;
            }
            return count;
        }

Open in new window

perkleyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gregoryyoungCommented:
check out ILMerge

It can make 1 dll out of many without any of the types of problems you are dealing with.

http://research.microsoft.com/en-us/people/mbarnett/ilmerge.aspx

Cheers.

Greg
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
perkleyAuthor Commented:
Like I said, I am new at .NET.  The documentation that downloaded with ILMerge didn't seem to clearly tell me what I was doing, but after reading this article:

http://www.codeproject.com/KB/dotnet/mergingassemblies.aspx

I found out how to use it for me and it worked great.  Thanks so much.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.