3

After leaving my machine alone for a couple weeks, I returned to do some Qt-using-VC10 work. The first sign of trouble was a QtCreator error about "cl" not being recognized, which led me to discover that C:\Windows\System32 had somehow been removed from PATH. The inability to identify the "reg" command was making vcvarsall.bat fail to set VS100COMNTOOLS, as described here.

The aforementioned thread directed me to this, which suggested simply adding C:\Windows\System32 back to PATH.

However, my troubles were not over. Once C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvars32.bat (a script invoked by vcvarsall.bat) was able to invoke "reg", it failed to find the key necessary for setting VS100COMNTOOLS. The failure occured at the following line:

for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Microsoft\VisualStudio\SxS\VS7"     /v "10.0"') DO (
    @if "%%i"=="10.0" (
        @SET "VS100COMNTOOLS=%%k"
    )
)

The output I got from vcvars32.bat (with unsuppressed output) was:

C:\Users\Bob\Desktop>for /F "tokens=1,2*" %i in ('reg query "HKLM\SOFTWARE\Micro
soft\VisualStudio\SxS\VS7" /v "10.0"') DO ()
ERROR: The system was unable to find the specified registry key or value.

Sure enough, the indicated location in my branch does not exist. The relevant subset of my registry tree looks like this:

HKEY_LOCAL_MACHINE\
  SOFTWARE\
    Microsoft\
      VisualStudio\
            10.0\
                Debugger\
            11.0\
                ...
            9.0\
                ...
            Debugger\ 
                ...

Does anyone know what is going on here? Could the automatic windows updates after my two weeks of absence be responsible? How do I fix my system so vcvarsall.bat can manage to set VS100COMNTOOLS?

Community
  • 1
  • 1
phizla
  • 132
  • 1
  • 6
  • Someone has messed up your machine. Either it's owned, or you have coworkers/family members/cleaning crew that monkeyed around with it. So far it looks like you need to reinstall the relevant visual studio version. Make sure that the *proper* `vcvars` scripts are being run (from the desired version of visual studio). – Kuba hasn't forgotten Monica Jun 12 '14 at 19:50

3 Answers3

1

I had essentially the same problem. In my case I was trying to install only the Visual Studio compilers and redistributables without any instances of the Visual Studio IDE. I took a long time looking into it, trying to resolve it 'correctly' without unnecessarily forcing environment variables or modifying or adding registry values.

Most advice starts with uninstalling any Visual Studio 2010 redistributes and/or compilers and then re-installing them in a particular order, usually after having installed the Windows SDK.

In my case this seemed to help but not completely resolve problems. I ended up doing the following. First in

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat

I commented out line 10 because if goto setup_buildsku is taken, the %VisualStudioVersion% variable never ends up getting set as it normally would later down in the file. (It doesn't matter that vcbuildtools.bat won't be called again, because I have that called first when I start my command prompt.)

Then, in

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat

in the labeled section GetVSCommonToolsDir, it goes looking in the registry at both HKLM and HKCU for

SOFTWARE\Microsoft\VisualStudio\SxS\VS7

and

SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7

The problem I had was (that because only the Build Tools are installed ?) there are no VS7 keys, only VC7 keys so the lookup fails.

Consequently I commented out lines 99-103 in vcvarsall.bat and my %VS140COMNTOOLSDIR% and %VS100COMNTOOLSDIR% variables are untouched. (They are already set in my environment before calling vcvarsall.bat).

Later, I see many "ERROR: Cannot determine the location of the VS installation." But my builds and compiles still proceed OK!

TT--
  • 2,956
  • 1
  • 27
  • 46
0

Yes, that's right. I had the same problem with the missing regKey SxS. After re-installing my Visual Studio 10.0 - update SP1 - the SxS HKM-RegKey was re-defined in the HKM.

0

Recently I installed Build Tools for Visual Studio 2019 on Wine and found that vcvars64.bat doesn't work.

It is mainly due to the difference of cmd between Wine and Windows. In addition, Wine(Windows) Registry doesn't have .NET Framework setup information.

What I added to Wine Registry is as below:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\VisualStudio\SxS\VC7]
"FrameworkDir32"="C:\\WINDOWS\\Microsoft.NET\\Framework\\"
"FrameworkDir64"="C:\\WINDOWS\\Microsoft.NET\\Framework64"
"FrameworkVer32"="v4.0.30319"
"FrameworkVer64"="v4.0.30319"
th yoo
  • 1
  • 1