[C++] Why won't MSVC generate assembly listings for my library in release mode?

I recently had an issue where MSVC wouldn’t generate assembly files for my library when in release mode. The files would appear when compiling and linking the whole application.

The issue was that enabling whole program optimisation (/GL, 1) would lead to the entire library being optimised out! Thankfully Ovod posted the solution on stackoverflow2.