Question

I need to have my own environmental variable (like $(VsInstallDir) ) for all projects in solution. How can i define it in my solution ?

I'm using VS2008, C++ solution

Was it helpful?

Solution

I had a similar problem and consequent question. Take a look at the answers there. The short answer is: use property sheets.

For example:

<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioPropertySheet
    ProjectType="Visual C++"
    Version="8.00"
    Name="MyIncludes"
    >
    <UserMacro
        Name="BoostInclude"
        Value="C:\Program Files\boost\boost_1_35_0"
        PerformEnvironmentSet="true"
    />
</VisualStudioPropertySheet>

OTHER TIPS

You could create a project (dll) which simply held all of your environment varaibles; call it solution_env.dll or something. All of the other projects in the solution would have to reference that dll.

I suspect that there are other, better ways to accomplish what you are trying to do, but then that depends on what you are actually trying to do. What I mean is, you have some goal, and you've already decided that the solution to your goal is to have a solution-wide environment variable(s), so you've asked how to do that. It may be more beneficial to ask if there are other ways to accomplish what you are really trying to do.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top