Where exactly is macro $(VCTargets) defined?

Chenbinhao 21 Reputation points
2020-08-21T03:13:55.57+00:00

We had a discussion before.

https://social.msdn.microsoft.com/Forums/vstudio/en-US/e04e7791-c0c4-4598-b900-310878f5af45/how-can-i-locate-and-change-the-vctargetspath-variable?forum=msbuild

After hours searching .props files, all the $(VCTarget) in .prop and .targets are deleted, but Visual Studio can still recognize this macro/variable correctly.

By modifing Microsoft.Cpp.ToolsetLocation.props, $(VCTarget) can be modified and in consequence VS can no longer create new project.

So, where exactly this macro defined?

I believed that this macro is and shouldn't be hardcoded.

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,540 questions
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
36,200 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Dylan Zhu-MSFT 6,406 Reputation points
    2020-08-24T06:04:14.467+00:00

    Hi Chenbinhao0352,

    Do you mean that the $(VCTarget) is $(VCTargetsPath)? The macro seems to be stored in the configuration file of msbuild tool. At last, I find it in MSBuild.exe.config file.

    19719-annotation-2020-08-24-134206.jpg

    Based on different properties and application environment, different macros are stored in different configuration files. So if you want to find other macros, maybe you need to take much time on it.

    Best Regards,
    Dylan

    1 person found this answer helpful.
    0 comments No comments