Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't load sample projects after local installation #207

Open
jperna7254 opened this issue Jun 14, 2023 · 3 comments
Open

Can't load sample projects after local installation #207

jperna7254 opened this issue Jun 14, 2023 · 3 comments

Comments

@jperna7254
Copy link

I followed the procedure for installation of the CUDA Toolkit found here
https://docs.nvidia.com/cuda/cuda-quick-start-guide/index.html#local-installer
After cloning this repo and attempting to load the projects I got the following error regarding importing the projects.

C:\Users\jerem\source\repos\cuda-samples\Samples\0_Introduction\clock_nvrtc\clock_nvrtc_vs2022.vcxproj : error  : The imported project "C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations\CUDA 12.1.props" was not found. Confirm that the expression in the Import declaration "C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations\CUDA 12.1.props" is correct, and that the file exists on disk.  C:\Users\jerem\source\repos\cuda-samples\Samples\0_Introduction\clock_nvrtc\clock_nvrtc_vs2022.vcxproj

This error popped up for all the projects and the reason was the CUDA 12.1.props and CUDA 12.1.targets files were not where my VCTargetsPath was pointing. My CUDA props file was located here

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\extras\visual_studio_integration\MSBuildExtensions\CUDA 12.1.props

But the VCTargetsPath was pointing here

C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations

So, it seems the default location for the local installation of the toolkit doesn't match where Visual Studio is expecting to find the visual c++ target files.

@eabase
Copy link

eabase commented Feb 27, 2024

This sucks, what's the solution?
I'm not gonna downgrade, these nvidia/MS dudes just gotta get their shit together.

@iamparik
Copy link

@jperna7254 @eabase in case you didn't find the fix, here is how I fixed the issue to run the samples.

In my case the error was "The imported project "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\BuildCustomizations\CUDA 12.4.props" was not found. Confirm that the expression in the Import declaration "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\BuildCustomizations\CUDA 12.4.props" is correct, and that the file exists on disk."

Step 1. I checked my .props and .targets version on my system, and I had 12.3 and 12.5 only. (so check what you have on your system, image below for location and files as on my system)

image

Step 2. Now go to your local repository with cuda samples and edit the .vcxproj file associated with your visual studio version. In my case this is *vs2022.vcxproj. We edit this, since .vcxproj is loosely the makefile equivalent for windows visual studio. Now change .props and .targets versions in the .vcxproj file to be the same as the ones in step 1 above. In my case I changed 12.4 to 12.5, which was the latest I had (see image below).

image

@Anonymous-Humanoid
Copy link

Anonymous-Humanoid commented Jan 24, 2025

Almost 2 years and this issue still persists. Found the CUDA 12.8 .props and .targets under %PROGRAMFILES%\NVIDIA GPU Computing Toolkit\CUDA\v12.8\extras\visual_studio_integration\MSBuildExtensions (which goes against documentation). Had to follow the above steps and modify the CUDAPropsPath element to point to the aforementioned directory instead of $(VCTargetsPath)\BuildCustomizations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants