In this article I will explain, how to resolve the following error: Severity Code Description Project File Line Suppression State The type 'Package' is defined in an assembly that is not referenced in ASP.Net.
Error
The following error occurs when you make use of
OpenXml Packaging library in .Net framework.
Severity Code Description Project File Line Suppression State
Error:CS0012 The type 'Package' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.IO.Packaging, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
This error indicates that, your project is attempting to use a type named 'Package' but lacks a reference to the assembly where this type is defined.
Solution
The solution to this error is to add the reference of WindowsBase library in your project.
Following are the steps to add the reference of WindowsBase library in your project.
1. Right click on the Project inside Solution Explorer window and click on Add and then Reference from the context menu.
2. Inside the Reference Manager Dialog window, expand the Assemblies options on Left side and look for WindowsBase and check (select) the CheckBox and click on OK.
3. Finally, re-build your project and run it. You will not receive the error again.