Faced the same problem
reinstalled CUDA tOOLKIT 12.4
removed all old versions of CUDA tools from add/remove progam files
went to visual studio 2022 installer and repaired community studio and build tools
Magically I can build now!