无法在ASP.NET 5 Core中使用iTextSharp

我正在尝试将iTextSharp与ASP.NET 5 Core一起使用。 但是,当我尝试使用iTextSharp 5.5.5构建ASP.NET应用程序时,我收到了这些错误

码:

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: // public string Index() { PdfReader reader = new PdfReader("template.pdf"); return "SomeText"; } } } 

错误:

错误CS0012类型“Uri”在未引用的程序集中定义。 您必须添加对程序集’System,Version = 2.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089’的引用。 MyProject.ASP.NET 5.0 MyProject / Controllers \ GenerateFileController.cs 17

错误CS0012“流”类型在未引用的程序集中定义。 您必须添加对程序集’mscorlib,Version = 2.0.0.0,Culture = neutral,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版本。

现在,而不是等待包更新,解决这个问题只是包括Asp.net 4.6框架和列出itextsharp作为依赖之一。

Packages.json

 "frameworks": { "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { "version": "1.0.1", "type": "platform" } }, "imports": [ "dotnet5.6", "portable-net45+win8" ] }, "net461": { "dependencies": { "iTextSharp": "5.5.10" } } },