Even now with the latest version of vSphere 8 this is a problem.
The best way to do this is to generate the DLL without the serialization assembly (which compiles quickly) and then generate the serialization assembly separately using sgen.exe.
sgen.exe takes ages to run but because it's running outside of the development evenvironment it does complete successfully.
It's quite faffy but fine when it's all completed - I've documented the whole process here:
https://david-homer.blogspot.com/2024/11/solved-compile-vsphere-management-sdk.html