I was working on some PDF generation for a customer that used AbcPDF in their ASP.NET MVC website.
The work was to move from basic MVC views written especially for PDF rendering, to reusing the same MVC views we send to the HTML browsers.
With more sophisticated markup, came more CSS styling. The default IE engine seemed to lack a few CSS features we used a lot (example, the
:not() CSS selector). So, we decided to use the Gecko engine.
The rendering was much better, with a single exception, that the option to choose media type (
All I needed to do, to add Gecko, was to install the
ABCpdf.ABCGecko NuGet package. Something like:
Install-Package ABCpdf.ABCGecko -Version 126.96.36.199
It took quite a while, and at the end, it showed me a message, saying that I need to manually (hate that word) copy a folder called
XULRunner21_0 to the MVC project’s
The Firefox / Gecko XULRunner Folder
The folder is needed for AbcPDF to connect to Firefox 21 (what’s used in v9, I guess it’s 38 in v10).
The folder, which has so many files and subfolders, was present in the root of my ASP.NET MVC project.
I didn’t want to have to commit this ~40 MB folder to our source control. The customer used NuGet package restore and didn’t want to keep binary files in source.
I know different people and different projects handle dependencies differently, and it can get interesting, but in my case, it was not wanted.
So, I modified the web project
.csproj file, and added the following after a
<Task> in the file:
This made the folder show up in the project web project root in Visual Studio, and get copied to the bin folder, but the actual files were pulled from the package folder, not left in the website root itself.
The approach in general is very useful for adding an entire folder as a linked item in Visual Studio. I hope that little trick has helped!
P.S. Please help me out by checking this offer, then look below for a small Thank You.
How did I learn that?
As a bonus for coming here, I'm giving away a free newsletter for web developers that you can sign up for from here.
It's not an anything-and-everything link list. It's thoughtfully collected picks of articles and tools, that focus on Angular 2, ASP.NET 5, and other fullstack developer goodies.