Tuesday, 29 December 2020

Open Source HTML to PDF converter

The software I inherited included a function for converting an HTML quote into a PDF.

It used a library from a 3rd party vendor, Winnovative Software. As I was re-hosting the server from IaaS to Azure App Services, I found that the library didn't work under the sandboxed App Service environment.

A different component was required, but it was covered under my license. But then I discovered that my license was for V14 and the new version was V15.

Could I download the previous version - the one I paid for? No. "It was over 2 years old" the company told me. They no longer provided download links. I would have to pay to upgrade.

So 2 years old is deemed too old to support now. And I would have to pay to get the later version to get features I didn't need nor want.

I thought this was rather unfair practice and so I did some more research.

And I stumbled across the excellent open source wkhtmltopdf tool. And even better, Adam Hockemeyer provided a docker image that did exactly what I needed - it hosted the tool as a .NET Core Web service in Azure App Service.

Max Kudos to Adam - you saved me hours and hours of effort, and prevented me rewarding bad support behaviour.

Wednesday, 23 December 2020

ASP.NET Core: FileNotFoundException: Could not load file or assembly

 I had a complex solution with multiple projects and NuGet references.

To debug one troublesome Nuget package, I removed the Nuget reference and added a project reference so I could step through the code.

However when the website ran, it would throw the error:

FileNotFoundException: Could not load file or assembly <troublesome assembly>


  1. procmon.exe indicated that the website wasn't even loading the assembly - or trying to
  2. <website>.deps.json didn't have a reference to the assembly
  3. Visual Studio Resharper was showing the following popup:


The problem was that I had added the project to the solution, but the project was located in a folder outside of the root solution folder. By taking a copy inside of the root solution folder and re-adding the reference, the <website>.deps.json then included the reference and the assembly loaded.

  1. Check your <website>.deps.json 
  2. Use ProcMon
  3. Make sure that the project referenced is inside your solution folder.