NVidia released CUDA Toolkit 9 with full support for Visual Studio 2017, so this guide is now irrelevant. Just install CUDA Toolkit 9 and be happy :) This is post will be preserved for future cases when new Visual Studio versions are released and CUDA Toolkit stays behind.
Visual Studio 2017 was released on March 7. Unfortunately, NVidia's CUDA toolkit still doesn't have official Visual Studio 2017 support. The good news are that you can at least build your CUDA projects that were created with Visual Studio 2015. Here's how:
Download full CUDA toolkit distribution and extract it somewhere on your disk. The exe file is just a self-extracting archive, so use any advanced archive tool such as WinRAR or 7Zip.
If you didn't have CUDA toolkit installed, do it now. If you have only Visual Studio 2017 installed, unselect
Visual Studio integrationcheckbox.
Go to the
CUDAVisualStudioIntegration\extras\visual_studio_integration\MSBuildExtensionsfolder in your extracted distribution, copy all the files and paste them to
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140\BuildCustomizations:
In the last step you will need to edit your Cuda projects to recognize NVidia's build tasks from Visual Studio 2017. Open your
.vcxprojfile in a text editor and find all occurrences of
CUDA 8.0.props. Replace the macro at the beginning of the string with
$(VCTargetsPath14)so that XML snippet would look as follows:
<ImportGroup Label="ExtensionSettings"> <Import Project="$(VCTargetsPath14)\BuildCustomizations\CUDA 8.0.props" /> </ImportGroup>
Don't forget to edit the custom targets path at the end of the file:
<ImportGroup Label="ExtensionTargets"> <Import Project="$(VCTargetsPath14)\BuildCustomizations\CUDA 8.0.targets" /> </ImportGroup>
And that's it! Now you can build your Cuda project from Visual Studio 2017 as well as Visual Studio 2015. This solution allows you only to build stuff and doesn't provide a way to use NVidia's debugging extensions. For those to work we will have to wait for official support from NVidia.