Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3679104
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T03:25:13+00:00 2026-05-19T03:25:13+00:00

[NOTE: This questions is similar to but not the same as this one .]

  • 0

[NOTE: This questions is similar to but not the same as this one.]

Visual Studio defines several dozen “Macros” which are sort of simulated environment variables (completely unrelated to C++ macros) which contain information about the build in progress. Examples:

    ConfigurationName  Release
    TargetPath         D:\work\foo\win\Release\foo.exe
    VCInstallDir       C:\ProgramFiles\Microsoft Visual Studio 9.0\VC\

Here is the complete set of 43 built-in Macros that I see (yours may differ depending on which version of VS you use and which tools you have enabled):

    ConfigurationName  IntDir           RootNamespace      TargetFileName
    DevEnvDir          OutDir           SafeInputName      TargetFramework
    FrameworkDir       ParentName       SafeParentName     TargetName
    FrameworkSDKDir    PlatformName     SafeRootNamespace  TargetPath
    FrameworkVersion   ProjectDir       SolutionDir        VCInstallDir
    FxCopDir           ProjectExt       SolutionExt        VSInstallDir
    InputDir           ProjectFileName  SolutionFileName   WebDeployPath
    InputExt           ProjectName      SolutionName       WebDeployRoot
    InputFileName      ProjectPath      SolutionPath       WindowsSdkDir
    InputName          References       TargetDir          WindowsSdkDirIA64
    InputPath          RemoteMachine    TargetExt             

Of these, only four (FrameworkDir, FrameworkSDKDir, VCInstallDir and VSInstallDir) are set in the environment used for build-events.

As Brian mentions, user-defined Macros can be defined such as to be set in the environment in which build tasks execute. My problem is with the built-in Macros.

I use a Visual Studio Post-Build Event to run a python script as part of my build process. I’d like to pass the entire set of Macros (built-in and user-defined) to my script in the environment but I don’t know how. Within my script I can access regular environment variables (e.g., Path, SystemRoot) but NOT these “Macros”. All I can do now is pass them on-by-one as named options which I then process within my script. For example, this is what my Post-Build Event command line looks like:

    postbuild.py --t="$(TargetPath)" --c="$(ConfigurationName)"

Besides being a pain in the neck, there is a limit on the size of Post-Build Event command line so I can’t pass dozens Macros using this method even if I wanted to because the command line is truncated.

Does anyone know if there is a way to pass the entire set of Macro names and values to a command that does NOT require switching to MSBuild (which I believe is not available for native VC++) or some other make-like build tool?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T03:25:13+00:00Added an answer on May 19, 2026 at 3:25 am

    As far as I can tell, the method described in the question is the only way to pass build variables to a Python script.

    Perhaps Visual Studio 2010 has something better?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Note: This is the opposite direction to most similar questions! I have an iPhone
(Note: I have seen several questions regarding .NET logging frameworks, but haven't seen any
(NOTE: This question is not about escaping queries, it's about escaping results) I'm using
Moderator note: This question is not a good fit for our question and answer
Note This is not a REBOL-specific question. You can answer it in any language.
(Note: This is for MySQL's SQL, not SQL Server.) I have a database column
I've seen some similar questions, but nothing that quite pointed me in the direction
I have seen many somewhat similar questions, but nothing quite what I'm looking for.
Similar questions: Some characters in CSV file are not read during PHP fgetcsv() ,
Note: Originally this question was asked for PostgreSQL, however, the answer applies to almost

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.