简体   繁体   中英

Epplus Exception thrown by the target of invocation

I am having problems with configuring the EPPLus library in my script task(C#) SSIS package. the following piece of code is throwing the error.

 using (var p = new ExcelPackage())
        {

            p.SaveAs(new FileInfo(@"C:\Users\..\Documents\myworkbook.xlsx"));
        }

I have tried changing the.Net target version for the script but nothing seems to work. Removing that block of code the script runs fine. EPPlus is version 5.1.1

use this line If you use EPPlus in a noncommercial context - ExcelPackage.LicenseContext = LicenseContext.NonCommercial; then you can go to next step - using(var package = new ExcelPackage(new FileInfo("MyWorkbook.xlsx"))){}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM