Why am I getting the build error "Cannot determine the location of the VS Common Tools folder"?

30 views (last 30 days)
While generating code using MATLAB Coder, Simulink Coder or Embedded Coder, I am receiving the following build error:
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\VCVARSALL.BAT" amd64
Setting environment for using Microsoft Visual Studio 2010 x64 tools.
ERROR: Cannot determine the location of the VS Common Tools folder.
What is the cause of this error and how can I resolve it?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 13 Sep 2019
Edited: MathWorks Support Team on 13 Sep 2019
This issue can occur if your machine does not have appropriate permissions to edit the registry. The Microsoft Visual Studio compilers are configured in such a way that they require the ability to query the system registry using "reg.exe". The compiler uses configuration batch files "vcvarsall.bat", "vcvars64.bat", and "VCVarsQueryRegistry.bat" that call the "reg query" command to query the registry for the paths of different components.
To verify that this is the cause, you can try the following:
  1. Open a Windows Command Prompt window (press Windows Key + R, type in "cmd" in the field that appears, and press "Enter")
  2. Enter the following commands, one-by-one, to query the registry:
reg query "HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v "10.0"
reg query "HKCU\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v "10.0"
reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" /v "10.0"
reg query "HKCU\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" /v "10.0"
If the output of each command shows:
"ERROR: Registry editing has been disabled by your administrator."
then this confirms that this is a permissions issue and you can perform either of the following actions:
  1. You can switch to using either the Microsoft SDK or MinGW compilers, as they will not impose the same requirements on permissions. Please see the links below for more information on each of these:* https://www.mathworks.com/help/matlab/matlab_external/install-mingw-support-package.html* https://www.mathworks.com/matlabcentral/answers/101105-how-do-i-install-microsoft-windows-sdk-7-1* Note: Simulink Real-Time does not support these two compilers.
  2. You can work with your IT administrators to change the permissions and/or "Group Policy" to allow the "reg query" commands on your machine. Obtaining sufficient permission should then allow the batch files mentioned above to execute successfully.
If the output does not show the error message, then please take a screenshot of the entire Windows Command Prompt window and of the entire build log of Simulink, and contact MathWorks Technical Support.

More Answers (0)

Categories

Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!