Environment variable ignored in the Visual Studio Express 2012 project

advertisements

I'm trying to open a solution in Visual Studio Express 2012 (which I think corresponds to Visual C++ 11, correct?). In a project in the solution there are some lines like this:

  <ImportGroup Label="PropertySheets">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
    <Import Project=".\$(ProjectName)_vc110.props" />
    <Import Project="$(OTHER_LIB_ROOT)\path\to\myprops.props" />
    <Import Project="$(OTHER_LIB_ROOT)\path\to\myother.props" />
    <Import Project="$(OTHER_LIB_ROOT)\path\to\some.props" />
  </ImportGroup>

Where $(OTHER_LIB_ROOT) is a reference to an environment variable that points to a third-party software install on my local machine.

When I try to load up the solution, it cannot load the project, saying that it cant find "C:\path\to\myprops.props". That to me says that it's replacing the variable with the empty string. I know the variable exists, as I can start a command prompt and type "echo %OTHER_LIB_ROOT%" and it shows me the correct path.

I have tried restarting VS and even rebooting the machine, but it still doesn't work. Is there something else I need to do to get it to pick up the correct value for the environment variable?


So it turns out there was a file that I hadn't looked in before, called ProjectName.props. it contained the following stanza:

  <PropertyGroup Label="UserMacros">
    <OTHER_LIB_ROOT>../../../../..</OTHER_LIB_ROOT>
  </PropertyGroup>

That relative path was obsolete (I had cribbed the project out of one of the vendor's samples), and lead to a path that does not exist. So I guess when VS tried to calculate the relative path it got "".

Once I changed the relative path to a valid absolute path, it worked just fine.