Aspose with Nancy (Could not load file or assembly Aspose.Foundation)

I’m trying to use Aspose.pdf with a Nancy webservice. However, as soon as I add the aspose nuget package to my project. The webservice fails to start with the following error:


Could not load file or assembly ‘Aspose.Foundation, Version=17.4.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56’ or one of its dependencies. The system cannot find the file specified.


You can reproduce this by creating a new empty asp.net application. Adding the Nancy and nancy.hosting.aspnet and Nancy packages. Create a hello world endpoint. This will work fine. Then add the Aspose.pdf nuget package and run the app again.


Sovled: The problem was due to the IOC container used by Nancy which attempts to register classes automatically.


Adding this to the bootstrapper stops this for the Aspose library and fixes the issue:

protected override IEnumerable<Func<Assembly, bool>> AutoRegisterIgnoredAssemblies => new Func<Assembly, bool>[]
{
asm => asm.FullName.StartsWith(“Aspose.”, StringComparison.InvariantCulture)
};

Hi Michael,


Thanks for contacting support.

We are glad to hear that your problem is resolved. However the problem related to missing binaries is already logged in our issue tracking system as PDFNET-42378. The product team is investigating the reasons behind this problem and as soon as we have some definite updates regarding its resolution, we will let you know.

We are sorry for this inconvenience caused.

Hi Michael,


Thanks for your patience.

We are pleased to share that the issue reported earlier is resolved in latest release of Aspose.Pdf for .NET 17.6. Please try using the latest release and in the event of any further query, please feel free to contact.