1

I currently have a ASP.Net Core app, which implies that all my class libraries are .Net core class libraries.

In one of those libraries, I need to use iTextSharp, which does not support .Net Core. I don't really care to execute this on linux, I just like the modularity of Asp.Net Core and all the template with the modern web development.

I found this: Unable to use iTextSharp with ASP.NET 5 Core which seems to indicate that we can reference the .Net 4.6 in a .Net core app.

But since VS2017, there is no more project.json, since it's directly included in the *.csproj.

So:

  1. Is it possible to reference a .Net 4.6(well a library from .Net full framework) in a .Net core library(if we are not gonna use it somewhere else than IIS?
    1. If yes, how?
    2. If no, do you have any idea what I can do?
3
  • BTW, have you checked "unofficial" iTextSharp builds that can be referenced from .NET Core apps, like nuget.org/packages/iTextSharp.LGPLv2.Core ? Commented Apr 5, 2017 at 16:30
  • @VitaliyFedorchenko I wanted to test your approach(for some other needs(tests), it would help if its true .net core), so I created a .NetCore project, imported the package you indicated. I can create the PdfReader, but I can't find the SimpleTextExtractionStrategy class in it? Commented Apr 18, 2017 at 16:25
  • I guess SimpleTextExtractionStrategy doesn't exist in iTextSharp 4.1.6 ( github.com/schourode/iTextSharp-LGPL ) and was added later. All versions after 4.1.6 are non LGPL and require commercial license. If you're commercial iTextSharp user you contact their representatives and ask for .NET Core support. Commented Apr 18, 2017 at 17:24

1 Answer 1

3

Check out the article Use ASP.NET Core 1.1 with .NET 4.6.

You simply need to edit your *.csproj file and replace netcoreapp1.1 to net46. When you do that your .NET Core app will run on full framework and you will be able to install iTextSharp package.

EDIT: To resolve issue with webpack middleware you need to directly reference System.Net.Http 4.3.1 package as mentioned in this comment.

Sign up to request clarification or add additional context in comments.

11 Comments

I was just reading it, I tried, now it compile but I get some exception `Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. HRESULT : 0x80131040, any idea?
It's on app.UseWebpackDevMiddlewareof the Startup.cs
I tried to add the corresponding nugget package, but still got this error. Not sure why, I got more info on this HRESULT: The located assembly's manifest definition does not match the assembly reference.
That could be because previously package was referenced for .net core app. Try to remove package and install again.
Try directly reference System.Net.Http 4.3.1 package as mentioned in this comment github.com/aspnet/JavaScriptServices/issues/…
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.