I have a file format that is made up of a number of files zipped up, kind of similar to the .docx file format. My application had been using the Ionic.Zip library to read and write those files, quite happily I must say.
I recently stumbled upon the System.IO.Packaging namespace and realised that as it's part of the .NET framework I could remove one more dependency in my application, great!
However after just a little experimentation I find that my optimism was misplaced. When I tried to open one of my existing .zip packaged files using System.IO.Packaging it couldn't find any files. After some googling it transpires that a [Content Types].xml file is required, for some reason, in order for System.IO.Packaging to be able to find anything in the zip file.
No problem I thought, I'll just create a dummy xml file, which should create that weird [Content Types].xml file and add the XML mime type to it, right?
Well yeah... that's what it does. Except it also deletes all of the existing xml files in the package!
WTF?!? Surely there must be a way to do this? Anyone?