Visual Studio 2008: Use an External Debug-DLL for Debug-Run and an External Release-DLL for Release-Run

Short version: If you run the program from VS2008 in Release mode, I want it to use pathA\externaldll.dll. If you run the program from VS2008 in debug mode, I want it to use pathB\externaldll.dll

Long version: I have a program that is connected to external dll files (VTK). I myself created an external application both in debug mode and in Release mode. External dll files are located as follows:

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

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

I want to go into external code for Debug Builds, but I want Builds releases to use release DLLs for runtime testing (I process large datasets).

Linking to the corresponding dlls is easy since I have project settings for this. But when executed, Visual Studio takes the first DLL that it finds in the PATH environment variable.

The idea of ​​a cumbersome solution: The presence of the PATH variable as: PATH =;% CURRENTDLLPATH%; and setting CURRENTDLLPATH in the post-build phase. Is there a solution built into VS2008?

+3
source share
4 answers

There is actually a built-in and easy way:

"Environment" -Variable in "project settings" / "Debugging".

So set the Environment-Variable to

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

for the project to be withdrawn does the trick.

, (, visual studio?)

+1

Dll Debug Release PATH?

0

, DLL PATH Debug Release.

0

./debug, ./release.

Copy the appropriate external DLL file to this output folder: use the pre-build step and use the VS macro $(ConfigurationName)to refer to debug / release.

0
source

Source: https://habr.com/ru/post/1756534/


All Articles