You may get this error if you are trying to install a package via NuGet into your .NET application. The full error reads something like:
Could not install package ‘Api2Pdf 1.0.1’. You are trying to install this package into a project that targets ‘.NETFramework,Version=v4.5.1’
, but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
The above error is specific to trying to install the Api2Pdf .NET client library (on Github here), but it is not specific to Api2Pdf. You may get a similar error with any package.
What this typically means is that the .NET framework that the library was compiled in is a newer version than the one you are running your .NET project on. Api2Pdf’s client library was written and compiled in .NET 4.6.1 and also works in .NET Core.
Option 1) The immediate fix would be to change the target framework of your project from .NET 4.5 to .NET 4.6.1 by right-clicking your project in Visual Studio, click Properties, and then change the target framework like so: https://s3.amazonaws.com/
Option 2) If you cannot change your target framework to 4.6.1 for whatever reason, then you can simply write c# code against our REST API. The NuGet package is just for convenience but consuming the REST api is very easy. Documentation is here: https://www.api2pdf.com/
Tags: api2pdf .net, api2pdf dotnet, html to pdf api dotnet
Comments are closed.