Reputation: 62333
I'm currently working on a console application that will pass a vcxproj file and compile it using GCC. Unfortunately, I've come up against a whole load of problems pretty much instantly.
I notice a bunch of directory shortcuts such as:
VCTargetsPath
VCInstallDir
SolutionDir
ProjectDir
UserRootDir
and so on.
Where does MSBuild get these values from? I assumed they were environment variables set up for the MSBuild process (afterall known environment variables are addressed the same way, ie "$(...)"). This was a bad assumption so I'm left wondering exactly how I get at these. Has anyone any idea on this?
Any info would be much appreciated :)
Upvotes: 0
Views: 2579
Reputation: 7253
The MSBuild executable (and dependent DLLs) processes those properties the same way it processes any other property in the build file. In this case, they're simply predefined properties that it looks for explicitly.
If you really want to dig into it, open up the Microsoft.Build.dll
in Reflector and look for the Microsoft.Build.Construction.SolutionProjectGenerator.AddGlobalProperties(...)
method to get an idea of how it's handling some of the well known properties.
As an additional note, make sure you fully navigate down Import directives and handle overwriting of property and item values with each Import. There's a number of properties and items that are part of a Visual Studio build that are not always necessary for your code to compile correctly.
Upvotes: 3
Reputation: 14125
Some of them are defined by the location of your files
Others are defined by the location of the MSVC install
C:\Program Files\Microsoft Visual Studio 8\VC
and so on, and would be internal to msbuild based on what you loaded.
Upvotes: 2