FS0193: error : Exception of type 'System.OutOfMemoryException'

I’m building a Excel wrapper for a Quantitative Finance library with 1031 modules, 15619 exported functions and and more than 30000 lambda functions: size is mentioned because the compiler fails with an out-of-memory error when 32-bit addressable memory is exhausted.

The library needs to use .NET Framework 4.8 because of the dependency on ExcelDNA and Excel/COM integration, but the fsc.exe shipped with Visual Studio is an x86 program. It would be non-trivial to split the library into a .NET Standard (built with the x64 fsc.exe that ships with .NET core) and a .NET 4.8 facade - If I could source a a 64-bit version of .Net Framework fsc.exe, the problem would be resolved.

Looking for advise whether to split the libary, or download and build the compiler as an x64 program
It needs to target .NET Framework 4.8 for Excel/COM integration