1

We're using visual studio 2005. I know, but it's what we have.

So, we have a project folder, plus some "other" code in another folder. The other code is from other groups and is read-only. Since we're using clearcase, this other code area is subject to change. Without going into a lot of boring detail (I still don't "get" clearcase myself so please don't ask), what we normally do is map the view of this other drive to a fixed drive letter using subst.

I'd like to get away from that and use one environment variable to reference that other code drive.

I defined an environment variable 'blah', pointing to the drive and path of this other code. I've got the solution files fixed up by simply referencing the env variable %blah%. My trouble is trying to get the project (vcproj) files to similarly behave when reference files from that other code area.

Within the vcproj file, I've tried:

< File RelativePath="%blah%..."

and

< File RelativePath="$(blah)..."

Neither work - I receive an error when I try to open the file:

u:\path\to\vcprojfile\$(blah)...\myfile.c Cannot open file.

Before I modified the vcproj file, the RelativePath attribute contained the absolute path to the file. So, why is the environment variable not being properly expanded? Can I even do what I want to do here?

Jon
  • 1,675
  • 26
  • 57

1 Answers1

1

Try to use UPPER CASE for your environment variable, and for the file's relative path. Use RelativePath="$(BLAH)\Folder\myfile.c" syntax. It works for me in VS2005.

user1810087
  • 5,146
  • 1
  • 41
  • 76
cha
  • 10,301
  • 1
  • 18
  • 26
  • Thanks for the reply. There was no difference with making the variable uppercase (the error dialog actually lowercased the same variable before displaying it). The & character you used also caused VS to complain. – Jon Mar 01 '13 at 15:29
  • sure, you need to use $. Typo. I have fixed it – cha Mar 02 '13 at 11:08
  • 1
    Okay. I restarted VS and yes, it picked up the environment variable (FYI: uppercase/mixed case seems to make no difference). I had previously just reloaded the project which did not (pick up the env var). I'm also exploring adding a custom property sheet (replacing the upgradedfrom.. prop sheet that each project seems to have) with a user macro defined therein, allowing the value to be customized for each user without having to set an env var. Would also be handy for developers having multiple clearcase views or other VCS branches have their own setup for locating the correct code. – Jon Mar 05 '13 at 16:01