I had everything working fine with v11.6.0. Then I installed 11.6.1, then 11.6.2, 11.7 and my project files broke with all of them. There were two problems and I fixed both of them. My environment is Windows 10 and Visual Studio 2019.
First was the fact that all of the sample projects I tried would not build because it couldn’t find the 11.6 build property files. My projects had the same problem. To deal with this I added an environment variable I called CUDA_VERSION and set it to 11.7. I changed my project files in two places to use these lines :
<ImportGroup Label="ExtensionSettings"> <Import Project="$(CUDAPropsPath)\CUDA $(CUDA_VERSION).props" /> </ImportGroup> <ImportGroup Label="ExtensionTargets"> <Import Project="$(CUDAPropsPath)\CUDA $(CUDA_VERSION).targets" /> </ImportGroup>
Note that this uses the CUDA_VERSION EV that I had made instead of using the literal CUDA version. This lets the same project file work with practically any version of CUDA.
The other problem is the CUDA .props file ignores the project’s intermediate directory configuration. I have reported this as a bug but the powers that be disagree with me. Here’s how you can make the CUDA compiler use the intermediate directory that YOU want.
The problem is this line in CUDA 11.7.props :
I changed it to :
and then the intermediate directory I configured for my project in VS will be used instead of the default directory.
Note - the CUDA 11.7.props file is in (VisualStudio)/MSBuild/Microsoft/VC/v160/BuildCustomizations for VS2019.