views:

7090

answers:

4

How do I set a path for dll's to be searched in Visual Studio for a particular project alone. Now I am setting it in environment path variable, but I would like better control over this.

+1  A: 

Set the PATH variable, like you're doing. If you're running the program from the IDE, you can modify environment variables by adjusting the Debugging options in the project properties.

If the DLLs are named such that you don't need different paths for the different configuration types, you can add the path to the system PATH variable or to Visual Studio's global one in Tools | Options.

Mr Fooz
+5  A: 

You have a couple of options:

  • You can add the path to the DLLs to the Executables files settings under Tools > Options > Projects and Solutions > VC++ Directories
  • You can add them in your global PATH environment variable
  • You can start Visual Studio using a batch file as I described here and manipulate the path in that one
  • You can copy the DLLs into the executable's directory :-)
Timo Geusch
With Visual Studio 2010, you can go in your project's property pages, and it's under "Configuration Properties -> VC++ Directories".
Kevin
+2  A: 

If you only need to add one path per configuration (debug/release), you could set the debug command working directory:

Project | Properties | Select Configuration | Configuration Properties | Debugging | Working directory

Repeat for each project configuration.

sean e
+2  A: 

Search MSDN for "How to: Set Environment Variables for Projects". (It's Project>Properties>Configuration Properties>Debugging "Environment" and "Merge Environment" properties for those who are in a rush.)

The syntax is NAME=VALUE and macros can be used (for example, $(OutDir)).

For example, to prepend C:\Windows\Temp to the PATH:

PATH=C:\WINDOWS\Temp;%PATH%

Similarly, to append $(TargetDir)\DLLS to the PATH:

PATH=%PATH%;$(TargetDir)\DLLS
Multicollinearity