Export (0) Print
Expand All

Macros in Project System Properties

This section discusses how to work with the object model in the Visual C++ project system from script and add-ins.

Macros can be present in almost any string property that you obtain from any object in the object model. The exceptions to this rule are:

When a property returns a value that may contain macros, use the property container with the most appropriate scope to evaluate it. The property containers, in order of narrowest scope to widest, are:

For a file or tool on a file configuration, the property container would be the VCFileConfiguration object for the desired configuration. For the project, this would be the VCConfiguration object for the desired configuration. Use the object with the most narrowly-scoped property container because the wider the scope of the object used is, the fewer macros that can be expanded properly.

In other words, when you move from a VCFileConfiguration to a VCConfiguration object to do your evaluation, you lose the context for all of the $(Input*) macros. When you move from a VCConfiguration to a VCProjectEngine or VCPlatform object, you lose the context for all macros that are not system wide.

The following table shows examples of how macros would be evaluated in various contexts. When,

  • File is c:\myidls\stuff.idl

  • Project is c:\Soln\Proj\Proj.vcproj

  • Solution is c:\Soln\Soln.sln

  • Platform is Win32

  • Intermediate directory is DebugInt

  • Output directory is c:\MyOutputs

  • Debug configuration

  • Output name is Game.exe

Macro

File configuration   

ProjectConfig

VCProjectEngine and VCPlatform

InputDir

c:\myidls\

c:\Soln\Proj

Not applicable

InputName

stuff

Proj

Not applicable

InputPath

c:\myidls\stuff.idl

c:\Soln\Proj\Proj.vcproj

Not applicable

InputFileName

stuff.idl

Proj.vcproj

Not applicable

InputExt

.idl

.vcproj

Not applicable

IntDir

DebugInt

DebugInt

Not applicable

OutDir

c:\MyOutputs

c:\MyOutputs

Not applicable

ProjectDir

c:\Soln\Proj\

c:\Soln\Proj\

Not applicable

ProjectName

Proj

Proj

Not applicable

ProjectExt

.vcproj

.vcproj

Not applicable

TargetDir

c:\MyOutputs\

c:\MyOutputs\

Not applicable

TargetPath

c:\MyOutputs\Game.exe

c:\MyOutputs\Game.exe

Not applicable

TargetName

Game

Game

Not applicable

TargetFileName

Game.exe

Game.exe

Not applicable

TargetExt

.exe

.exe

Not applicable

ConfigurationName

Debug

Debug

Not applicable

RemoteMachine

Set at project level

Set at project level

Not applicable

PlatformName

Win32

Win32

Not applicable

SolutionDir

c:\Soln

c:\Soln

c:\Soln

SolutionName

Soln

Soln

Soln

SolutionPath

c:\Soln\Soln.sln

c:\Soln\Soln.sln

c:\Soln\Soln.sln

SolutionFileName

Soln.sln

Soln.sln

Soln.sln

SolutionExt

.sln

.sln

.sln

VCInstallDir

<VC install dir>\

<VC install dir>\

<VC install dir>\

VSInstallDir

<VC install dir>\

<VC install dir>\

<VC install dir>\

FrameworkDir

<COM+ dir>\

<COM+ dir>\

<COM+ dir>\

FrameworkVersion

Common language runtime version used by the development environment

Common language runtime version used by the development environment

Common language runtime version used by the development environment

DevEnvDir

Location of devenv.exe

Location of devenv.exe

Location of devenv.exe

Environment macros

According to environment

According to environment

According to environment

Notice that what you pick for the source of your evaluator can significantly change how things evaluate, particularly for items closely related to file names.

Community Additions

ADD
Show:
© 2015 Microsoft