How do I set the path to a DLL file in Visual Studio?

dll, visual-c++, visual-studio

Solution

- Go to project properties (Alt+F7)

- Under Debugging, look to the right

- There's an Environment field.

- Add your relative path there (relative to vcproj folder) i.e. ..\some-framework\lib by appending `PATH=%PATH%;$(ProjectDir)\some-framework\lib` or prepending to the path `PATH=C:\some-framework\lib;%PATH%`

- Hit F5 (debug) again and it should work.

Problem

I developed an application that depends on a DLL file. When I debug my application, the applicationwould complain that: "This application has failed to start because xxx.dll was not found." So I have to copy the DLL file into the same directory as my .vcproj file. Is there a way to set the project to look for the DLL file in (preferably) some relative path or (not preferred) some absolute path? Similar concept to how we set include and library path in the project settings. I mean when I debug my application (hitting F5) the above error would pop up.

Original source

Related problems