Visual Studio 2010 - How to use system environment variables?

I am very grateful for the help or ideas on a very unpleasant problem. In my experience, it seems that at any time when I need to organize or update my decisions / projects, I understand how bad and bad the program really is. I always ultimately have to find a hack or run into an unpleasant test due to a failure that forces me to start from scratch at least once during the process.

In any case, my problem is that I was updating projects from 2005 to 2008, and it was time to launch 2010. For my old projects, I decided at some point to use the System Environment variables to set as my output directory.

Example:

  My machine:
 System-> Advanced Settings-> Environment Variables 3DSMAX_DEV_ROOT_32 = F: / Temp / Rampage /
 My Project-> General:
 Output Directory = $ (3DSMAX_DEV_ROOT_32)
 My Project-> Linker-> General:
 Output File = $ (OutDir) MyPlugin.dll

This has always worked on Visual Studio 2005 and 2008, and I am still heavily dependent on it. However, in 2010, this simply will not work. I would be surprised if I were the only one who dealt with this, but I did not see anyone else come across this. Others mentioned project environment variables, but I didn't see anything on the system ones. In any case, if you have ideas on how to make them work or know why they now seem to completely ignore them, I would like to hear about that. Worse, I know that leading numbers are usually no-no, but my EV is them, and VS EV is not allowed to have them. I know how I can get around this, but I am on the development team, and this change will be a huge pain for everyone.

Thanks for taking the time to read.

Eric

+4
source share
3 answers

PATH is a pretty special environment variable - you shouldn't use it to specify a temporary directory for VS output.

Note that by default, VS does not use the following environment variables from your env system, instead overriding them with its own:

  • PATH
  • INCLUDE
  • LIBPATH
  • LIB

If you want VS to use your system variables for them, you need to run Visual Studio with the /useenv option:

 devenv /useenv 

But you should still use a different variable than PATH - this is really very special. (I'm a little surprised that setting System->Advanced Settings->Environment Variables Path = C:/Temp/ does not cause you all other problems).

+4
source

Well, I know this is kind of a late answer, but I had the same problem and ended up here so that others could find a useful solution.

The problem is specific to the variable name: 3DSMAX_DEV_ROOT_32

Visual Studio 2010 does not extend environment variables that begin with a number.
This was not in Visual Studio 2008.

Rename or add the variable THREEDSMAX_DEV_ROOT_32 with the same value, and this variable will be correctly expanded when used in the project property.

+1
source

This happened to me, too, what happened after a new installation of Visual Studio 2010 or any of the libraries involved.

Of course, first check if your environment variables are set (and correct). When I switched from Visual Studio 2005 in 2010, I also switched from Windows XP to Windows 7, and then some programs were installed in the β€œProgram Files (x86)” folder instead of β€œwithout” (x86). Pay attention to this!

When you right-click on the included file, which, as you know, should be in one of the paths set by the environment variables, and click "open file", Visual Studio 2010 should provide you with a list of included directories in which it was viewed. When environment variables are not readable, this part is empty and may seem something simple, for example, "/ include" instead of "C: / Program Files / YourProgram / include".

My solution was pretty simple because after rebooting the computer it worked ... Just try and see if this is suitable for you. I think this is due to the activation of environment variables, they are globally configured on reboot. Therefore, if you change one, you need to reboot to make the change effective.

0
source

All Articles