CUDA Visual Studio Integration fails every time

Hi guys,

I’ve been trying to install CUDA 9.1 on this development machine with a GeForce GTX 1050 Ti card, but every time I try to run the setup, it fails at Visual Studio Integration.
If I uncheck that upon installation, everything goes fine.

I have Visual Studio Enterprise 2015 Update 3 installed on this machine, but it had VS 2017 and VS 2013 installed as well at some point in time (been trying to get an NVidia Quadro 400 to work with CUDA 6.x on this very same machine, so I had to install VS 2013 at some point in time).
All other Visual Studio versions have been removed via the Control Panel, and the folders that I’ve found here and there (Program Files/ProgramData) have been deleted as well (technically there shouldn’t be any sight of previous Visual Studio installations on this machine)

The OS is Windows Server 2012 R2 64bit with an i7-4820K and 32GB of RAM.

I tried running the setup.exe with logging, and I have the following ERRORS in the log file:

ERROR: [UpdateCore.UpdateCoreExtSite] 557@CUpdateCoreExtSite::ReportUpdateCoreTasksState : Failed to load NvTelemetryStatusReporter.dll:  126. 

ERROR: [NVI2.NVMsiPhase] 853@CNVMsiPhase::InvokePhase : COM error: -2147467259. 

ERROR: [NVI2.NVInstaller] 2064@CNVInstaller::InternalPerformInstall : Package "visual_studio_integration_9.1" failed with error: Exception {0x80004005 - Unspecified error; File: PerformInstall.cpp; Line: 4029; Phase failure}. 

ERROR: [NVI2.NVInstaller] 2123@CNVInstaller::InternalPerformInstall : Failing at package "visual_studio_integration_9.1" failed with error: Exception {0x80004005 - Unspecified error} - aborting install. 

ERROR: [NVI2.InstallThread] 54@CInstallThread::ThreadProc : Install failed - Exception {0x80004005 - Unspecified error; File: PerformInstall.cpp; Line: 4029; Phase failure} - going to fail state.

Please let me know what has to be done to get this thing up and running, so I can get into running the simple samples from the toolkit.

Same problems. Sigh…

I had the same problem and finally I could find a solution. Visual Studio integration failed every time. I tried all possible combinations and nothing worked (Visualstudio 2010, VisualStudio 2017, Cuda 9.1.85, 9.0, 8.0, 7.5). I also tried reinstall windows 10 in all possible ways. Fortunately the method sugested by @oregonduckman and orangesherbet0 worked for me (https://devtalk.nvidia.com/default/topic/1033111/cuda-setup-and-installation/cuda-9-1-cannot-install-due-to-failed-visual-studio-integration/):

Step 1: Install the standard VGA driver:

  1. Bring up the Windows Device Manager. You can do that my right-clicking on the Start button and then select Device Manager.
  2. Expand the “Display Adapter” list, right-click on the GeForce card and then select “Update Driver Software”.
  3. Click “Browse my computer for driver software”.
  4. Then click the “Let me pick from a list of device drivers on my computer”.
  5. Uncheck the “Show compatible hardware” option.
  6. Under the “Manufacture” scroll to the top and select the “(Standard display type)” and then click “Next”. If you are running multiple GPUs then repeat steps #2 - #6 for each GPU.
  7. Restart Windows. This will basically load the standard VGA driver.

Step 2: Delete all Cuda reference:

  1. In Windows Services, stop all nvidia services
  2. Delete all nvidia files from C:\ProgramData, C:\Program Files, C:\Program Files(x86).
  3. Proceed with cuda installation.

I tried @pagr solution and that didn’t work for me.
Env:
Windows 10
Nvidia GTX 1080i
Latest VS Studio 2017 installed late Nov 2018
Cuda 10 local exe installer

  1. Use the windows add/remove program to remove any previous Nvidia cuda installations you might have. Under step 2 from pagr12 I mistakenly just deleted these which leaves you with a corrupt registry. To fix that - I went and reinstalled Cuda 8 in my case, then used windows remove programs to correctly remove all of them.
  2. Run the Cuda 10 installer, accept license etc. But don’t proceed yet.
  • Copy the path where the installation files are to be expanded.
  1. Go to the path mentioned above, and find the folder “CUDAVisualStudioIntegration” and copy it to one of your own locations.
  2. Go to Custom Install.
  3. Deselect the two options under development for Visual Studio Integration and Insight.
  4. Complete the install. Hopefully at least this works and you get passed it.

Visual Studio:

  1. Run the installer in the folder you grabbed from step 3 above.
  2. Even after this… might not be good - so dig into CUDAVisualStudioIntegration\extras\visual_studio_integration\MSBuildExtensions and grab the files there. Copy them to C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\BuildCustomizations
  3. Restart Visual Studio.

CUDA will put the samples in C:\ProgramData\NVIDIA Corporation\CUDA Samples\v10.0 which is a weird directory - Windows didn’t show this when I went to C: in win explorer… so type it in and you can get there. Here there will be permission problems if you try and open the solution in visual studio - so right click on the CUDA Samples directory - hit properties, go to advanced and give Full Access permissions to your “Users” group. Now try and open the VS 2017 solution.

  • Note you should probably just change the samples install dir to something custom when doing install.

MORE problems - the ‘target’ windows driver is messed up - to fix this, right click top level solution and select retarget projects… let that finish. Save everything and ensure no problems.

Next issue - trying to run device query in debugger I was getting issue on many dlls: cannot find or open the pdb file"… do this:
Tools->Options->Debugging->Symbols : Check “Microsoft Symbol Server”
Couple more options to help with this one – see

If you get issue about toolkit not found… go to project (not solution) and right click, properties, Configuration, cuda, and fix Toolkit Custom Dir… probably with:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0
Also ensure that the above directory …/bin and …/libnvvp are in your PATH.

ANOTHER Problem:
Right click, debug device query – for me saying:
cudaGetDeviceCount returned 35
→ CUDA driver version is insufficient for CUDA runtime version
Result = FAIL

Digging – seems I have my old Cuda8 dlls in the C:\windows\system32 directory.

Yea – so this one took me a long time to resolve. Here’s what finally did it after I had done everything above.
On Install → Custom, I could see the version of my display driver, and GEForce Experience, and HD Audio were all newer than what came with my Cuda 10 install.
So I uninstalled those 3 things using windows add/remove programs. Then I went and downloaded a version of Nvidia Display driver for my card that was at or before the version mentioned in the Cuda Custom Install.
Couple computer restarts.
Now install cuda again. If you did everything above you don’t need to get samples again. Just make sure and uncheck VS Studio Integration in the custom install. That still didn’t work.

So after that and another restart – I was able to run my deviceQuery but this time with
deviceQuery.exe Starting…

CUDA Device Query (Runtime API) version (CUDART static linking)

cudaGetDeviceCount returned 30
→ unknown error
Result = FAIL

In running cuda custom install – it confirmed that new/current versions were the same across the board. So at least nvidia thinks it installed everything.
So I went into GEForce Experience – did the update driver again, selected everything – and as soon as that was done – my deviceQuery in visual studio, and on command line worked perfectly

This solution only took me about 8 hours of my life. Nice work Nvidia!

Dan C.

Problem solved !!

After guru3d DDU nvidia complete uninstall in safe mode, unplug your ethernet cable (to avoid the automatic reinstall of nvidia driver at the next boot), then reboot in normal mode

Then dince Windows 10 was not responding to my uninstall request, i used Revo uninstaller to remove all remaining programs (using revo uninstaller free version), aand then it worked !!