How it works...

In steps 1 to 5, we created a blank solution using Visual Studio 2017 and gave it a proper, meaningful name. In steps 7 to 10, we added a .NET Standard 2.0 class library to the project. We renamed the default Class1.cs generated by the template in step 12. In step 14, we added two namespaces to the code. The System.IO.Compression namespace contains all the necessary classes for compressing and decompressing. In step 15, we added a private variable that holds the path to compress. In this case, it is a folder.

Step 16 introduced the constructor with a source path parameter to zip. In step 17, we created a method that uses the ZipFile class and its method to compress a given source folder. And then, finally, we created a method ...

Get .NET Standard 2.0 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.