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

  • SEARCH
  • Home
  • 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 109091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:00:53+00:00 2026-05-11T02:00:53+00:00

In Visual Studio 2003, I am trying to set an environment variable in the

  • 0

In Visual Studio 2003, I am trying to set an environment variable in the pre-build event that will then be used in the compilation step, but the value doesn’t seem to be propagated. For example, if the pre-build event contains this (either directly or within a batch file):

set MY_LIB_VERSION=1.0.0 

and AdditionalIncludeDirectories has this:

c:\path\to\library\my_lib_v$(MY_LIB_VERSION)\include 

then I would expect the compilation to work if the my_lib_v1.0.0 directory exists. But instead, I get

 c:\path\to\prog\my_prog.c(22) : fatal error C1083: Cannot open include file: 'my_lib.h' Project : warning PRJ0018 : The following environment variables were not found: $(MY_LIB_VERSION) 

I deduce that the environment variable set in the pre-build event therefore isn’t being propagated to the compilation step, but I may be missing something.

How can I set the environment variable in the pre-build event and use it in the compilation step?

(Alternatively, any other sensible ways of defining a library version once and using it several times for AdditionalIncludeDirectories and AdditionalLibraryDirectories would do just as well.)


Update: I ended up solving our problem in a different way. We are using Subversion, and set up the svn:externals property on a subdirectory of the project source called dependencies, such that a checkout of the project would additionally check out <svn_path>\libraries\my_lib_v1.0.0 and call it dependencies\my_lib in the working copy. Then the project settings could refer to dependencies\my_lib\include and suchlike. Upgrading to version 1.0.1 of my_lib is then simply a matter of editing the svn:externals property — the code and project settings did not need to change.

  • 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. 2026-05-11T02:00:54+00:00Added an answer on May 11, 2026 at 2:00 am

    You might want to investigate this tool: http://workspacewhiz.com/SolutionBuildEnvironmentReadme.html

    We use it all the time to manage environment variables in our build environment.

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

Sidebar

Related Questions

I had a Visual Studio 2003 application that would render graphics to my web
I have Visual Studio 2003 project and I have set all of the AssemblyInfo
How do I confirm that SP1 for Visual studio 2003 is installed on my
I'm opening a solution that was apparently built on Visual Studio 2003 (not sure,
I installed visual studio 2008 first. Then I installed visual studio 2003. The icons
I am trying to make an Outlook 2003 add-in using Visual Studio 2008 on
I'm trying to maintain a Setup Project in Visual Studio 2003 (yes, it's a
I am extending the Visual Studio 2003 debugger using autoexp.dat and a DLL to
So I have Visual Studio 2003 running on Windows 7 - yeah I am
How do I exclude specific .dlls from Visual Studio 2003 C++ .NET? During release

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.