Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Extract files from zip file

(0) ShareShare
ReportReport
Posted on by 551

Hi experts,

I use AX 2012.

I want to extract files from a zip file archive. I have been told to do this:

System.IO.Compression.ZipFile::ExtractToDirectory(filePath, myZipFileName);

When I enter that into AX 2012, it says that "ZipFile" is not a class. (And when I write "System.IO.Compression.", I can also see that "ZipFile" is not on the list of options after "Compression".

What must I do to make this work?

Is there another way to do this?

Hope you can help.

  • Morten Steengaard Profile Picture
    551 on at
    RE: Extract files from zip file

    Hi Martin,

    Now I have added a reference to "System.IO.Compression.FileSystem" and removed my reference to "System.IO.Compression.ZipFile".

    Now it works fine.

    Thank you very much!

  • Verified answer
    Martin Dráb Profile Picture
    231,772 Most Valuable Professional on at
    RE: Extract files from zip file

    According to ZipFile documentation, you need System.IO.Compression.FileSystem.dll as well. Adding it sounds like a good next step.

    Also, pay attentions to versions. I can't say whether you should use a different version without knowing which version you're referencing at the moment.

  • Morten Steengaard Profile Picture
    551 on at
    RE: Extract files from zip file

    I don't have the DLL file. I just made the reference without pointing to any file. "System.IO.Compression.ZipFile" is on the long list called "Add reference". I guess that is the list of what is in the GAC plus what might have been added.

    Can I update the GAC or should I install a new version of .NET or how do I get, what I am missing?

  • Martin Dráb Profile Picture
    231,772 Most Valuable Professional on at
    RE: Extract files from zip file

    Where did you find the DLL? What is its version?

    Just adding the reference isn't sufficient if the process (such as AX client) can't load the file at runtime. If it's not in Global Assembly Cache (GAC), you'll need to put it to bin folder of AX client and possbly the bin folder of AOS (if you want to run the code on server). If it's in GAC, you don't have to do that - it would mean that your problem is caused by something else.

  • Morten Steengaard Profile Picture
    551 on at
    RE: Extract files from zip file

    Hi Martin,

    Thank you for your reply.

    No, I did not. (Working with dll files is new to me.)

    Now I have added a new reference in the AOT. In the list, "Add reference", I found "System.IO.Compression.ZipFile" and pressed "Select" and "OK".

    If I in the list, "Add reference" press "Browse", I can see the files in "C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin". There are no files called "System.IO...".

    I have compiled, left AX and entered AX again. I still get the compilation error.

  • Martin Dráb Profile Picture
    231,772 Most Valuable Professional on at
    RE: Extract files from zip file

    Do you have a reference to System.IO.Compression.ZipFile.dll?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,892 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,772 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans