VS2010 command prompt gives error: Cannot determine the location of the VS Common Tools folder

Viewed 126428

I have installed VS2010. The installation creates the shortcut for VS2010 command prompt but when I open up the command prompt I get the error:

Cannot determine the location of the VS Common Tools folder.

I checked the environment variable VS100COMNTOOLS and it has value: C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\ and the registry for HKEY_local_Machine\Software\Microsoft\Visual Studio\SxS\VS7 is set to: C:\Program Files\Microsoft Visual Studio 10.0\.

I checked the VSvars32.bat and tried to add echo to find till where it proceeds. It fails at this command:

@call :GetVSCommonToolsDirHelper32 HKLM > nul 2>&1
24 Answers

I had the same issue and found the answer here.

The problem is that the bat uses de reg command and it searches that in the PATH system variable. Somehow you have managed to get "C:\Windows\System32" out of the PATH variable, so just go to the system variables (right click "My Computer" > "Properties" > advanced config > "Environment Variables", search the PATH variable and add at the end separated by ";" : C:\Windows\System32

I was getting the same error when trying to run a publish process through powershell on my build machine.

My build machine only has the Windows SDK installed and not Visual Studio and as such it appears that I'm missing some common files and registry values that are normally present when Visual Studio is installed. After looking into vsvars32.bat a bit more carefully I noticed that it was where the "Cannot determine the location of the VS Common Tools folder" error was being reported located under the GetVSCommonToolsDir label. It appears that in this batch file that since the VS7 sub-key doesn't exist on my machine it blanks out the %VS100COMNTOOLS% environment variable and reports back the specified error.

In my case it appears that this error is happening for me because I don't have Visual Studio or some other necessary components installed on my build machine and thus the registry key doesn't exist. Perhaps your error is due to something similar such as 32-bit vs 64-bit registry or 32-bit vs 64-bit VS command prompt? Testing the line of code that is failing from the batch directly in the command prompt should give you a clue about why the registry or file path isn't being resolved properly.

A simple solution to solve this issue both in vs developer command prompt and cmd is to add the following line

C:\Windows\System32

into the system path as follows:

My Pc-->properties-->Advanced-->Environment variables-->system variables hope it solves the issue.

My problem was a little bit different. As mentioned by @kzfabi - a registry entry is made to get details of the installed VS version. So the user executing the developer command line tools exe needs admin access as well as registry editing rights. In controlled environment set up by companies you may not have these rights and cause this error.

Related