I am trying to create a zip folder and add a simple text file to it using my ASP.Net app running on .NET 4.6.1. I keep getting an error thrown and I have no idea how to correct it. The error is a result of trying to open the Readme.txt file. I have marked in the code where I am seeing the error. I notice that when trying to open the readmeEntry variable that it has Length and CompressedLength showing error 'System.InvalidOperationException'.
System.MissingMethodException: 'Method not found: 'Void System.IO.Compression.DeflateStream..ctor(System.IO.Stream, System.IO.Compression.CompressionLevel, Boolean)'.'
using (FileStream zipToOpen = new FileStream(path + "\\" + reportFileNameZip, FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite))
{
using (ZipArchive archive = new ZipArchive(zipToOpen, ZipArchiveMode.Update, true))
{
ZipArchiveEntry readmeEntry = archive.CreateEntry("Readme." + "txt");
using (StreamWriter writer = new StreamWriter(readmeEntry.Open()))
{
writer.WriteLine("Information about this package.");
}
} //ERROR MESSAGE //
}