EPPlus 5/6
LicenseException
Why do I get this exception?
New major version - new license model
EPPlus has up until version 4 been licensed under the LGPL open source license, but from version 5 we are licensing EPPlus under the Polyform Noncommercial 1.0.0..
You can find more details about the license change and why we are doing this here. For more information on our Commercial licenses, see our License FAQ
Commercial licenses can be purchased here on our website.
With this new setup we are determined to put all our efforts into improving EPPlus and it will also enable us to be more responsive and available to our customers.
License Exception
The purpose of this Exception is to make all EPPlus users aware of the new license. You don't need a specific license key to use EPPlus 5, see below how to proceed.
This exception is only thrown when a debugger is attached, so you don't have to configure this in a production/release environment.How do I get rid of the LicenseException?
There are three alternative ways:
1. Use the LicenseContext property on the ExcelPackage class
// If you are a commercial business and have
// purchased commercial licenses use the static property
// LicenseContext of the ExcelPackage class:
ExcelPackage.LicenseContext = LicenseContext.Commercial;
// If you use EPPlus in a noncommercial context
// according to the Polyform Noncommercial license:
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
using(var package = new ExcelPackage(new FileInfo("MyWorkbook.xlsx")))
{
}
2. appSettings.json
{
{
"EPPlus": {
"ExcelPackage": {
"LicenseContext": "Commercial" //The license context used
}
}
}
}
...or in the app.config...
<appSettings>
<!--The license context used-->
<add key="EPPlus:ExcelPackage.LicenseContext" value="NonCommercial" />
</appSettings>
3. Set the environment variable 'EPPlusLicenseContext'
This might be the easiest way of configuring this. Set the variable to one of the two following values:
- Commercial
- NonCommercial
Important! The environment variable should be set at the user level.