3

Short version: If running a program from VS2008 in Release mode, I want it to use pathA\externaldll.dll. If running a program from VS2008 in Debug mode, I want it to use pathB\externaldll.dll

Long version: I have a programm that is linked against external dll-files (VTK). I have built the external application myself in both Debug and Release mode. The external dll-files are located like this:

<some path>\Debug\externalDll.dll
<some path>\Release\externalDll.dll

(so they are called the same, but have different folders).

I want to step into the external code for Debug Builds, but I want the Release Builds to use the Release DLLs for testing the execution time (I process big datasets).

Linking to the according dlls is easy, as I have project settings for that. But when executing, Visual Studio takes the first dll it finds within the PATH environment variable.

Cumbersome solution idea: Having the PATH variable like: PATH=;%CURRENTDLLPATH%; and setting CURRENTDLLPATH in a post-build-step. Is there no solution built-in into VS2008?

B3ret
  • 597
  • 5
  • 19

4 Answers4

1

Actually there is a built-in and easy way:

The "Environment"-Variable within "project settings"/Debugging.

So setting the Environment-Variable to

PATH=C:\Paraview\ParaView-3.8.0\gen\bin\$(ConfigurationName);%PATH%

for the project to be exectued does the trick.

The question was answered several times here, I just didn't find it (e.g. How do I set a path in visual studio?)

Community
  • 1
  • 1
B3ret
  • 597
  • 5
  • 19
0

Why don't you give different file names to the external Dlls in Debug and in Release, and add both directories to the PATH?

Igor
  • 26,650
  • 27
  • 89
  • 114
  • Because renaming the resulting dll-files won't do the trick (as the .lib-Files point to the old file-names) and the external application uses a build-system I am not very familiar with (Cmake). I'd had to dig deeply into the external build system to find and rename all the external dll build-targets according to the configuration. – B3ret Jul 26 '10 at 10:05
0

You could add a build step to copy the correct DLL to the folder in PATH, and make different build steps in Debug and Release mode.

Frederik Slijkerman
  • 6,471
  • 28
  • 39
0

Your debug build output files should go to a ./debug folder and your release output files should go to a ./release folder.

You should copy the appropriate external DLL file into this output folder: Use a pre-build step and use the VS macro $(ConfigurationName) to refer to debug/release.

Martin Ba
  • 37,187
  • 33
  • 183
  • 337