1
votes

In VS2017 location of Visual C++ Tools has new installation model

Now it is located somwhere like C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25203. Or it can be for example C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017. So full path depends on VS2017 edition and build number.

There is a macro $(VCInstallDir) which points to ..\VC** folder. But I need to know full path including part which depends on VS2017 **build number. I need this to find Visual C++ tools' include folder.

So can I determine this path without calling VS2017 Command Prompt (VCVARSALL.BAT) or PowerShell script etc.? Is thete some VS macro that I can simply put into VC++ Directory\Additional Directories property of my project?

1
Why do you change the default include path? If you leave it as is, and only use the additional include path, you will never have such issues. - rustyx
I'm changing additional include path, but I'm not building solution via VS2017 - I'm calling NMAKE (which calls MSBUILD for solution inside). - bairog

1 Answers

6
votes

Check out MSBuild variable $(VCToolsInstallDir), it should do the job for you. It is available in VS2017 C++ projects and its value is set to something like

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.12.25827\

(depending on your tools version). Alternatively you can use $(VCInstallDir) and $(VCToolsVersion) to construct the path, but $(VCToolsInstallDir) should be more reliable.

P.S. Please note these variables only work in VS 2017 and are not available in previous versions of Visual Studio.