How to build Cuda toolkit projects in Visual Studio 2017
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:
Install additional components for Visual Studio 2017. Open
Individual componentstab and selectVC++ 2015.3 v140 toolsetunderCompilers, build tools and runtimes:
Install .NET Framework 3.5 if you didn't have it installed. Open Classical Control Panel, go to
Programs and featuresand pressTurn Windows features on or off. Check.NET Framework 3.5and press OK.
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 toC:\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 ofCUDA 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.