我正在尝试将 iTextSharp 与 ASP.NET 5 Core 一起使用。但是,当我尝试使用 iTextSharp 5.5.5 构建 ASP.NET 应用程序时,出现这些错误
Code:
using Microsoft.AspNet.Mvc;
using System.IO;
using System;
using iTextSharp;
using iTextSharp.text;
using iTextSharp.text.pdf;
// For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
namespace MyNamespace
{
public class GenerateFileController : Controller
{
// GET: /<controller>/
public string Index()
{
PdfReader reader = new PdfReader("template.pdf");
return "SomeText";
}
}
}
Errors:
错误 CS0012 类型“Uri”是在未在程序集中定义的
参考。您必须添加对程序集“系统”的引用,
版本=2.0.0.0,文化=中立,
PublicKeyToken=b77a5c561934e089'。我的项目.ASP.NET
5.0 MyProject/Controllers\GenerateFileController.cs 17
错误 CS0012 类型“Stream”是在不是在程序集中定义的
参考。您必须添加对程序集“mscorlib”的引用,
版本=2.0.0.0,文化=中立,
PublicKeyToken=b77a5c561934e089'。 MyProject.ASP.NET Core
5.0 MyProject/Controllers\GenerateFileController.cs 17
当我尝试使用 ASP.NET 4.6 模板执行相同的操作时,效果很好。问题是我想在这个项目中使用 ASP.NET 5 Core。有什么解决办法吗?
大多数现有软件包尚不支持 asp.net Core 5;由于差异显着,需要手动更新。如果您想使用 iTextSharp,您要么需要坚持使用 asp.net 5(不是 Core),要么等待 iTextSharp 的创建者发布 Core 版本。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)