1

Is it possible to get this variables programmatically?

http://msdn.microsoft.com/en-us/library/c02as0cs(VS.90).aspx

so inline with my question here I need to get the actual value of these variables programmatically outside of visual studio. Can I use "GetEnvironmentVariable(String, EnvironmentVariableTarget)" for this?or any other suggestions

getting the value of $(ProjectDir), $(SolutionDir) in a vcproj file

Community
  • 1
  • 1
3ggerhappy
  • 223
  • 2
  • 4
  • 14
  • From outside of Visual Studio you want to be able to figure out what project/solution are open in Visual Studio and what directory those are in? That doesn't make much sense. How could your code running outside of Visual Studio know this? Maybe if you explain what you're actually trying to do (instead of asking how to implement your solution idea), we can help. – Robert Levy Feb 11 '11 at 19:48
  • Hi what I am trying to do, is to get project properties in a vcproj file by reading the file as an xml/text, then extract the properties from it. It turns out c++ projects makes use of these variables thats why I want to know its actual value. What I mean by outside of VS is that I need to get the value programmatically. I am open in the idea of probably interfacing with VS studio to suit my needs. – 3ggerhappy Feb 11 '11 at 20:00
  • @3ggerhappy: Hi, I want to do something similar were you able to find answer to this question?, thanks. – int80h Jul 26 '12 at 15:41

1 Answers1

1

They are not environment variables. Macros is the name used in the MSDN literature. Maybe that makes sense if you realize that a solution can contain more than one project. $(ProjectDir) constantly changes as the build progresses. You already know their values, $(ProjectDir) is the directory where you found the .vcproj file, $(SolutionDir) is the directory where you found the .sln file. (This sounds familiar).

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536