1

I am using MS Visual Studio 2008.

I want to configure the Working Directory of my projects, and other directories. I found the list of available macros for this purpose.

Is there a practical way to evaluate the value of these macros?


PS: I am developing with Intel Visual Fortran Compiler XE 12.0 update 4, but this is possibly irrelevant for my question.

PS2: see also

Link to all Visual Studio $ variables

Is there a list of Visual Studio environment variables?

How/Where are the environment variables in a Visual Studio C++ project set?

Community
  • 1
  • 1

2 Answers2

0

Best option found so far (it can be much improved):

Right click on the project. Then Properties -> Configuration Properties -> Build Events -> Pre-Build Event and edit the Command Line field. Add one

echo {VarName} = $({VarName})

line for each {VarName} that one wants to evaluate. Cons:

  1. There are far fewer macro variables available for pre-build events than for other configurations.

  2. If no build is triggered, then the pre-build event commands are not executed. So, a build has to be at least initiated for the dump to be obtained.

  3. The pre-build event is launched for every subsequent build (until removal of the command line?).

This can hardly meet the qualifier "practical", but is more practical than nothing. Thus, I am still waiting for better answers...

0

You can see their values using the UI. In project properties, go to e.g. the Output Directory input field, select Edit in the dropdown, then press the [Macros>>] button. Unfortunately you can't easily copy the values for automated processing, but you can easily inspect them.

Owen Wengerd
  • 1,628
  • 1
  • 11
  • 11
  • In the Output Directory input field I can only type. There is no dropdown list. Perhaps this is a peculiarity of my version (NSVS2008, ver 9.0.21022.8, with .NET v3.5 SP1). – sancho.s ReinstateMonicaCellio Apr 09 '14 at 02:36
  • If you're in C++ project properties, a dropdown arrow should display when you start editing any field that can evaluate macros. If that doesn't happen for you, then I suspect you are either using the wrong type of project or in the regular property sheet instead of the project properties dialog. – Owen Wengerd Apr 09 '14 at 13:32
  • I have only Intel(R) Visual Fortran project types available for creation. Among them, I selected Console Application, Empty Project. Perhaps that is the source of the difference. What is "the regular property sheet"? – sancho.s ReinstateMonicaCellio Apr 10 '14 at 15:23
  • Sorry, I don't have Fortran installed so I can't check, but you're probably right that it doesn't support that feature for whatever reason. The "regular property sheet" is what you get when you press Alt-Enter (or choose View -> Properties Window). – Owen Wengerd Apr 10 '14 at 19:41