As above. I don’t think there is really an answer outside of those suggested in the link you provided. Modularise your code or use preprocessor macros.
If neither of them are an option then you might be able to modify the engine so you can run a custom version of Generate VS Project files which selectivly includes / excludes, or perhaps modify the build process itself but I imagineyou wouldn’t find too much information on what that involves other than reading through the source.