Solve "Unable to load freetype6.dll" issue in MonoGame projects

Recently I was working on the documentation for my personal projects. Being a side step of this task, I need to make sure all my projects are able to be compiled and built without hassle. As the process goes, everything works fine until I started to look at two of my games that use MonoGame framework. Same procedure as usual, I downloaded and installed MonoGame SDK from the official site, and opened my projects in Visual Studio 2015 to compile. This worked before, so I didn’t think too much about it. After all, “what could possibly go wrong?“, right?

…Right?

Well, things did go wrong. I got this exception during compiling:

System.DllNotFoundException: Unable to load DLL ‘freetype6.dll’: The specified module could not be found. (Exception from HRESULT: 0x8007007E)

I am pretty sure this is a quite recent thing, as I have never seen it before in my previous attempts of building MonoGame-based games following the same procedure. MonoGame SDK packages are supposed to work out-of-box since they have installers. It seems that something is wrong in these packages.

Well, after doing some research, I figured out why this happens. The above exception occurred because MonoGame pipeline tool (MGCB.exe) has a dependency on SharpFont, which in turn has a dependency on FreeType (after all, SharpFont is a “Cross-platform FreeType bindings for .NET“). Unfortunately, the FreeType library which MonoGame SDK packages contain for Windows platform (freetype6.dll) was built on Microsoft Visual C++ 2012, which requires Visual C++ 2012 Redistributable Package to function. Without this package, Windows will hit a barricade and fails to load freetype6.dll into memory. This causes SharpFont to throw a DllNotFoundException, which bumps up and leads to the runtime failure of MonoGame pipeline tool.

To solve this issue, one can use one of the following ways: