EDIT: Ok, got it working finally, had to add to all the groups in the csproj file. As it was failing then in the x86 build and ARM.
Hello Sathiyathanam,
As stated in my reply, none of those two ways work properly, I checked the ilclog and seems to be using the correct compiler, which is the version 64.
I also tried the first solution of adding only the needed references (Well, I didn't quite try it, as we always use only the needed ones and not the whole SDK):
With Use64BitCompiler
The RAM usage of Visual Studio while creating an installer goes up to ~7Gb (that's the max which I've seen) only with all the other things we have running in the machines our memory usage is about ~12Gb, so there is still plenty of RAM left, we also tried closing all of our applications while creating the installer, that way the system has more available for it, but the max usage is the same and the average used by the system in total is about 9Gb.
Without Use64BitCompiler
Without the 64bit Compiler, we get to a max of ~4Gb which is normal and then it throws the nutc_driver.exe error, which is expected as that's the max.
Let me know if there is any other solution, those two don't work. Also all of our PCs got enough ram (16Gb DDR4), or at least it should be enough.