'cub is ambiguous' with 11.6 sdk and VS2022

I’m trying to compile code that worked fine in the past with VS2019 and 11.5 and earlier Cuda SDK’s. But now with VS2022 and 11.6. And I am getting errors where I seem to mix cub and thrust:

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\include\cub\warp\specializations/warp_scan_shfl.cuh(121): error : “cub” is ambiguous
1> detected during:
1> instantiation of class “cub::WarpScanShfl<T, LOGICAL_WARP_THREADS, PTX_ARCH> [with T=int, LOGICAL_WARP_THREADS=32, PTX_ARCH=520]”
1>C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\include\cub\block\specializations…/…/warp/warp_scan.cuh(167): here
1> instantiation of class “cub::WarpScan<T, LOGICAL_WARP_THREADS, PTX_ARCH> [with T=int, LOGICAL_WARP_THREADS=32, PTX_ARCH=520]”
1>C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\include\cub\block\specializations/block_scan_warp_scans.cuh(81): here
1> instantiation of class “cub::BlockScanWarpScans<T, BLOCK_DIM_X, BLOCK_DIM_Y, BLOCK_DIM_Z, PTX_ARCH>::_TempStorage [with T=int, BLOCK_DIM_X=128, BLOCK_DIM_Y=1, BLOCK_DIM_Z=1, PTX_ARCH=520]”
1>C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\include\cub\util_type.cuh(369): here
1> instantiation of class “cub::AlignBytes::Pad [with T=cub::BlockScanWarpScans<int, 128, 1, 1, 520>::_TempStorage]”
1>C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\include\cub\util_type.cuh(376): here
1> instantiation of class “cub::AlignBytes [with T=cub::BlockScanWarpScans<int, 128, 1, 1, 520>::_TempStorage]”
1>C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\include\cub\util_type.cuh(428): here
1> [ 16 instantiation contexts not shown ]

Ok I have found out why. The thrust library is now bringing the cub namespace into itself as thrust::cub. So now any code that was doing a ‘using namespace thrust’ in its .cu file and directly including the cub header gets this annoying error.