Click here to Skip to main content
15,888,113 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to use Rotativa to save the view to PDF. It is failing with the error:

TypeLoadException: Could not load type 'Microsoft.AspNetCore.Builder.CookieAuthenticationOptions' from assembly 'Microsoft.AspNetCore.Authentication.Cookies, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.

I have installed the Nuget packages:
Microsoft.AspNetCore.All(2.0.3)
Microsoft.AspNetCore.Mvc(2.0.1)
Rotativa.NetCore(1.0.4)
RotativaCore(2.1.1)

If I do load <microsoft.aspnetcore.authentication.cookies>, I get the same error

What I have tried:

My code in the controller is below:

public IActionResult GetSign()
{
var sign = new List<sign>
{
new Sign {Name = "Rami1", Company = "Rami",DateSigned=DateTime.Now},
new Sign {Name = "Rami2", Company = "Rami",DateSigned=DateTime.Now}
};
return View(sign);
}

public ActionResult GeneratePDF()
{
return new Rotativa.NetCore.ActionAsPdf("GetSign");
}

I have installed RotativaNetCore(1.0.4) and RotativaCore(2.1.)
Posted
Updated 31-Dec-17 20:50pm

1 solution

I believe so that you missed when the .NET Core 1.x was upgraded to .NET Core 2.0. For example, if you move ahead and check the existence of CookieAuthenticationOptions, you will not find it because it was removed. You need to change your code and then rebuild it. Read my article that I have linked below and check other API changes in the ASP.NET Core 2.0 version below.

ASP.NET Core 2.0 Microsoft.AspNet.Builder API reference[^]

Read my article covering a few of these points for ASP.NET Core, Mission Impossible: Migrating .NET Core 1.x to 2.0[^], lastly never forget to check the API reference for .NET Core at .NET API Browser | Microsoft Docs[^]
 
Share this answer
 
Comments
Mike Margolius 14-Jan-18 2:54am    
Thank you for your information. I have tried to follow your instructions, with no success. My application was based on Core 2.0, as I wrote it in that version initially.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900