MSBuildToolsPath is not specified for the ToolsVersion

Abstract: Incorrect values in your registry can lead to this error

Q. When I try to compile any Delphi or C++ project I get the following error:

[Fatal Error] MSBuildToolsPath is not specified for the ToolsVersion "14.0" defined at "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0", or the value specified evaluates to the empty string.


How do I resolve this error?

A. This error is caused by incorrect values in the registry. On a 32 OS, run regedit and navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild. On a 64 bit OS, run regedit and navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSBuild. First, backup this registry key by selecting File | Export. Next, look at the numbers below the ToolsVersions key. Delete any number not found at the MSBuild level.

For example, here is an example of incorrect values in the registry:

Note how 14.0 appears below ToolsVersions, but does not appear at the MSBuild level. This is the problem.

Here is an example of the above registry key after it has been corrected:

There is anecdotal evidence to suggest this registry key imbalance is caused by uninstalling some versions of Visual Studio, but it has not been confirmed at this time.