none
How to use a ZIP file from Application resource. RRS feed

  • Question

  • Hello i was using the following codes in .NET framework 4.5
    using System;
    using System.Windows.Forms;
    using System.IO.Compression;
    using System.Reflection;
    
    namespace prj_Installer.Forms
    {
        public partial class Installing
        {
            void Install()
            {
                ZipFile.ExtractToDirectory(Resource.FilePath, Program.FilePath);
            }
        }
    }
    how i can get my zip File directory without extracting nor using it from another directory?

    Thanks from now.


    Saturday, March 4, 2017 5:26 PM

All replies

  • Starting with .NET 4.5 you have the ZipArchive Class. Using it and it's brothers allows you to practically treat a zip-File like a folder. In particular you can treat each Entry like a file in a folder:
    https://msdn.microsoft.com/en-us/library/system.io.compression.ziparchiveentry.aspx


    Remember to mark helpfull answers as helpfull and close threads by marking answers.

    Saturday, March 4, 2017 7:27 PM
  • Hi,

    Thank you for posting MSDN forum.

    System.IO.Compression namespace provides methods to zip and unzip files. For creating zip file, that

    namespace provides ZipArchive class. That represents a zip file. Now it's time to insert files, so we can use FileOpenPicker to pick files and to add files in archive, we will use ZipArchiveEntry class

    Here is a complete demo that can would be helpful for you.

    Best Regards,

    Hart


    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, March 31, 2017 6:15 AM