In this article I will explain how to solve the following compilation error:
CS0012: The type 'System.IO.Packaging.Package' is defined in an assembly that is not referenced. You must add a reference to assembly 'WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
The above error occurs when we use the OpenXml Packaging Library.
 
 
The Problem
When using OpenXml Packaging Library, .Net framework throws the following compilation error.
 CS0012: The type 'System.IO.Packaging.Package' is defined in an assembly that is not referenced. You must add a reference to assembly 'WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
 
 
The Solution
The solution to this problem is to add reference of WindowsBase library by right clicking the project in Solution Explorer window and then clicking Add Reference option from the context menu.
The above action will open up the Add Reference Dialog and from the .Net Tab, you need to choose WindowsBase library and click OK.
[Solution] The type 'System.IO.Packaging.Package' is defined in an assembly that is not referenced