Problem With Visual Studio Integration & a Fix

I had a problem with the Visual Studio Integration when I recently installed v11.6.0. I use VS2019 on Windows 10. I loaded up my application’s project and it failed to build. I then tried to load the Mandelbrot sample and it failed to build also so I decided to fix it first. I opened the project file in a text editor and found it references files for v11.4 - CUDA 11.4.props and CUDA 11.4.targets. I looked into the directory where those things go and found three files with the name CUDA 11.6. I changed the project file, re-loaded it, and it built and ran correctly.

I then loaded my project into the text editor and found I use references to CUDA $(CUDA_VERSION).props. When I looked at the environment variables I found this CUDA_VERSION=11.6.0. Those BuildCustomization files do not exist. I think the best answer to this issue was to copy those three files and rename them using names starting with “CUDA 11.6.0.***”. When I did this my project correctly builds and runs. Using the environment variable like this has allowed me to painlessly update to the latest versions many times, until this one, but this was an easy fix to make.

Note that every sample project I looked at had this issue so none of them could be built.